name: Publish Docker image # Community Applications installs a PREBUILT image — it never builds from source. # This publishes ghcr.io/asherflynt/music-librarian on every push to main and on # every version tag, so the CA template always has an image to pull. on: push: branches: [main] tags: ["v*"] workflow_dispatch: concurrency: group: publish-${{ github.ref }} cancel-in-progress: true env: IMAGE: ghcr.io/${{ github.repository }} jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write # push to GHCR under this repo — no external secrets needed steps: - name: Checkout uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker metadata (tags + labels) id: meta uses: docker/metadata-action@v5 with: images: ${{ env.IMAGE }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha,format=short - name: Build and push uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max