name: Release image on: push: tags: - "v*" workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: publish: runs-on: ubuntu-latest permissions: contents: read packages: write id-token: write attestations: write steps: - name: Checkout uses: actions/checkout@v7 # The Dockerfile cross-compiles with Go's GOOS/GOARCH from $BUILDPLATFORM, # so no QEMU emulation is needed for the arm64 image. - name: Set up Buildx uses: docker/setup-buildx-action@v4 - name: Log in to ${{ env.REGISTRY }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Derive tags and labels id: meta uses: docker/metadata-action@v6 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} # A semver tag v1.3.4 publishes 1.3.4, 1.3, 1 and latest. # A manual run from a branch publishes only that branch name, so # dispatching from main never moves the latest tag. tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=ref,event=branch labels: | org.opencontainers.image.title=SkunkyArt org.opencontainers.image.description=An alternative frontend for DeviantArt that works entirely without JavaScript - name: Build and push id: build uses: docker/build-push-action@v7 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} # Link the tag into the binary, so --help and /api/instance report the # same version as the image tag. build-args: | VERSION=${{ steps.meta.outputs.version }} cache-from: type=gha cache-to: type=gha,mode=max - name: Attest build provenance uses: actions/attest-build-provenance@v2 with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} subject-digest: ${{ steps.build.outputs.digest }} push-to-registry: true