Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ name: ghcr.io publish docker image
on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.event.repository.full_name }}

jobs:
push_to_registry:
name: Push Docker image to ghcr.io
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
Expand All @@ -31,13 +40,13 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ghcr.io/${{ github.event.repository.full_name }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
tags: |
type=ref,event=branch
type=ref,event=tag
Expand All @@ -47,5 +56,10 @@ jobs:
id: vars
run: echo "GIT_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Build and push Docker image
run: GIT_SHA=$GIT_SHORT_SHA docker buildx bake all --push
- name: Build and push
uses: docker/bake-action@v6
with:
push: true
provenance: true
env:
REPO: ${{ env.IMAGE_NAME }}