docs: prepare the repo for people who aren't me #74
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and push Docker image | |
| on: | |
| push: | |
| branches: [master] # build-check only — publishes NOTHING (see push: below) | |
| release: | |
| types: [published] # the ONLY event that publishes :latest + version tags | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Login only needed when we actually push (release). Master build-check skips it. | |
| - name: Log in to GHCR | |
| if: github.event_name == 'release' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/alpinearchitecture/programmarr | |
| tags: | | |
| type=raw,value=latest,enable=${{ github.event_name == 'release' }} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern=v{{major}}.{{minor}} | |
| type=sha,prefix=sha-,format=short,enable=${{ github.event_name == 'release' }} | |
| # push: true ONLY on a release. On a master push this is a pure build-check — | |
| # it proves the image compiles but pushes nothing to GHCR, so no user ever pulls it. | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event_name == 'release' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |