name: Release image on: release: types: [published] workflow_dispatch: permissions: contents: read packages: write concurrency: group: release-image cancel-in-progress: false jobs: # One leg per registry, so a registry having a bad day (Cloudflare rate # limits git.tben.me's blob uploads) can never fail the release image that # the installer installs from by default. image: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - registry: ghcr.io login_username: ${{ github.actor }} login_password: ${{ secrets.GITHUB_TOKEN }} soft: "false" - registry: git.tben.me login_username: ${{ secrets.GITEA_USERNAME }} login_password: ${{ secrets.GITEA_TOKEN }} soft: "true" continue-on-error: ${{ matrix.soft }} steps: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 - name: Log in to ${{ matrix.registry }} uses: docker/login-action@v3 with: registry: ${{ matrix.registry }} username: ${{ matrix.login_username }} password: ${{ matrix.login_password }} - name: Work out image tags id: tags env: EVENT: ${{ github.event_name }} RELEASE_TAG: ${{ github.event.release.tag_name }} REGISTRY: ${{ matrix.registry }} 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' \ "${REGISTRY}/moduletrace/cobble:latest" \ "${REGISTRY}/moduletrace/cobble:${version}" \ "${REGISTRY}/moduletrace/cobble:${minor}" \ "${REGISTRY}/moduletrace/cobble:${sha}")" else tags="$(printf '%s\n' \ "${REGISTRY}/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,scope=${{ matrix.registry }} cache-to: type=gha,mode=max,scope=${{ matrix.registry }}