From 8fd2b26d9b6869736e993a8a632c7d5a5ce9db89 Mon Sep 17 00:00:00 2001 From: jeanGaston Date: Thu, 30 Jul 2026 11:42:23 +0200 Subject: [PATCH] ci: add GitHub Actions workflow to publish image to GHCR Mirrors the existing .gitea/workflows/docker-publish.yml but targets ghcr.io on the GitHub mirror. Simpler than the Gitea version since the built-in GITHUB_TOKEN has native package-write rights on GHCR, no PAT secret needed. --- .github/workflows/docker-publish.yml | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..354ef99 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,37 @@ +name: Publish Docker image + +on: + push: + branches: [main, master] + tags: ['v*'] + +permissions: + contents: read + packages: write + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Compute lowercase image name + run: echo "IMAGE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ghcr.io/${{ env.IMAGE_NAME }}:latest + ghcr.io/${{ env.IMAGE_NAME }}:${{ github.sha }}