Publish Docker image #4
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: Publish Docker image | |
| # Runs when a release is published (release-on-spec cuts one per Mealie | |
| # version) — ships the same version as a multi-arch Docker image on GHCR | |
| # (linux/amd64 + linux/arm64, so it runs natively on Apple Silicon too): | |
| # ghcr.io/djwmarcx/better-mealie-mcp:<version> and :latest | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: publish-docker | |
| cancel-in-progress: false | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | |
| - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Log in to GHCR | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ACTOR: ${{ github.actor }} | |
| run: printf '%s' "$GH_TOKEN" | docker login ghcr.io -u "$ACTOR" --password-stdin | |
| - name: Build and push image (amd64 + arm64) | |
| env: | |
| REPO: ${{ github.repository }} | |
| run: | | |
| # Tag = <mealie-version> plus -r<n> for MCP-only revisions (rev 1 = base). | |
| VER="$(tr -d 'v[:space:]' < MEALIE_VERSION)" | |
| REV="$(tr -dc '0-9' < REVISION 2>/dev/null || echo 1)"; REV="${REV:-1}" | |
| TAG="$VER"; [ "$REV" -gt 1 ] && TAG="${VER}-r${REV}" | |
| IMG="ghcr.io/$REPO" | |
| docker buildx build --platform linux/amd64,linux/arm64 \ | |
| -t "$IMG:$TAG" -t "$IMG:latest" --push . |