name: Release image on: release: types: [published] workflow_dispatch: permissions: contents: read packages: write concurrency: group: release-image cancel-in-progress: false jobs: image: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 - 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: Log in to Gitea uses: docker/login-action@v3 with: registry: git.tben.me username: ${{ secrets.GITEA_USERNAME }} password: ${{ secrets.GITEA_TOKEN }} - name: Work out image tags id: tags env: EVENT: ${{ github.event_name }} RELEASE_TAG: ${{ github.event.release.tag_name }} run: | set -euo pipefail sha="sha-${GITHUB_SHA::12}" if [ "$EVENT" = "release" ] && [ -n "$RELEASE_TAG" ]; then version="$RELEASE_TAG" minor="$(printf '%s' "$version" | sed -E 's/^v?([0-9]+)\.([0-9]+).*/\1.\2/')" tags="$(printf '%s\n' \ "ghcr.io/moduletrace/cobble:latest" \ "ghcr.io/moduletrace/cobble:${version}" \ "ghcr.io/moduletrace/cobble:${minor}" \ "ghcr.io/moduletrace/cobble:${sha}" \ "git.tben.me/moduletrace/cobble:latest" \ "git.tben.me/moduletrace/cobble:${version}" \ "git.tben.me/moduletrace/cobble:${minor}" \ "git.tben.me/moduletrace/cobble:${sha}")" else tags="$(printf '%s\n' \ "ghcr.io/moduletrace/cobble:${sha}" \ "git.tben.me/moduletrace/cobble:${sha}")" fi { echo "tags<> "$GITHUB_OUTPUT" - name: Build and push uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.tags.outputs.tags }} provenance: false sbom: false cache-from: type=gha cache-to: type=gha,mode=max