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@3d3c42e5aac5ba805825da76410c181273ba90b1 # 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@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4 - name: Log in to ${{ env.REGISTRY }} uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Derive tags and labels id: meta uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # 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@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # 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@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4 with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} subject-digest: ${{ steps.build.outputs.digest }} push-to-registry: true