name: Docker # Publishes container images to GitHub Container Registry (ghcr.io). # master push -> :edge, :sha (amd64, fast) # tag v* -> :X.Y.Z, :X.Y, :latest, :sha (linux/amd64 + linux/arm64) on: push: branches: [master] tags: ["v*"] workflow_dispatch: permissions: contents: read packages: write jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} type=raw,value=edge,enable={{is_default_branch}} type=sha,format=short - uses: docker/build-push-action@v6 with: context: . # multi-arch only for release tags (arm64 under emulation is slow) platforms: ${{ startsWith(github.ref, 'refs/tags/v') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max