From 4ac0cf254b9c1eefc7540c1977f0e3365e1f7d54 Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Sun, 11 Jan 2026 00:34:35 -0600 Subject: [PATCH] Add workflow to publish to GitHub Container Registry --- .github/workflows/publish_ghcr.yml | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/publish_ghcr.yml diff --git a/.github/workflows/publish_ghcr.yml b/.github/workflows/publish_ghcr.yml new file mode 100644 index 0000000000..561b75e831 --- /dev/null +++ b/.github/workflows/publish_ghcr.yml @@ -0,0 +1,63 @@ +# publish_ghcr.yml +name: Publish + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + publish: + if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }} + name: "Publish to GitHub Container Registry" + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Enable Docker Cache + uses: ScribeMD/docker-cache@0.5.0 + with: + key: docker-${{ runner.os }}-${{ hashFiles('dependencies.sh') }} + + - name: Checkout Project + uses: actions/checkout@v6 + + - name: Docker Meta + id: docker_meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + ghcr.io/starfly-13/sf13 + # add git short SHA as Docker tag + tags: | + # branch event + type=ref,event=branch + # pull request event + type=ref,event=pr + # full length sha + type=sha,format=long + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + if: ${{ github.event_name != 'pull_request' }} + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push Docker Image + uses: docker/build-push-action@v6 + with: + context: . + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + push: ${{ github.event_name != 'pull_request' }}