name: Publish container images (GHCR) on: workflow_run: workflows: ["Mark stable commit"] types: [completed] jobs: prepare: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest permissions: contents: read outputs: should_publish: ${{ steps.info.outputs.should_publish }} version: ${{ steps.info.outputs.version }} is_stable: ${{ steps.info.outputs.is_stable }} steps: - name: Checkout repository (with tags) uses: actions/checkout@v7 with: fetch-depth: 0 - name: Checkout workflow_run commit and refresh tags env: WORKFLOW_RUN_SHA: ${{ github.event.workflow_run.head_sha }} run: bash scripts/github/publish-containers/checkout-workflow-run-commit.sh - name: Check whether tagged commit is on main id: branch-check env: TARGET_SHA: ${{ github.event.workflow_run.head_sha }} run: bash scripts/github/common/check-tagged-commit-on-main.sh - name: Compute version and stable flag id: info if: steps.branch-check.outputs.is_on_main == 'true' run: bash scripts/github/publish-containers/compute-publish-container-info.sh build: needs: prepare if: ${{ needs.prepare.outputs.should_publish == 'true' }} runs-on: ${{ matrix.target.runner }} permissions: contents: read packages: write strategy: fail-fast: false matrix: distro: &distros [arch, debian, ubuntu, fedora, centos] target: - platform: linux/amd64 runner: ubuntu-latest - platform: linux/arm64 runner: ubuntu-24.04-arm steps: - name: Checkout workflow_run commit uses: actions/checkout@v7 with: ref: ${{ github.event.workflow_run.head_sha }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@594f3bf4285d9ea8dc53c9a0c9c4092420091003 with: use: true - name: Login to GHCR uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push ${{ matrix.distro }} for ${{ matrix.target.platform }} env: OWNER: ${{ github.repository_owner }} VERSION: ${{ needs.prepare.outputs.version }} PKGMGR_DISTRO: ${{ matrix.distro }} PLATFORM: ${{ matrix.target.platform }} run: bash scripts/github/publish-containers/publish-container-images.sh merge: needs: [prepare, build] if: ${{ !cancelled() && needs.prepare.outputs.should_publish == 'true' }} runs-on: ubuntu-latest permissions: contents: read packages: write strategy: fail-fast: false matrix: distro: *distros steps: - name: Checkout workflow_run commit uses: actions/checkout@v7 with: ref: ${{ github.event.workflow_run.head_sha }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@594f3bf4285d9ea8dc53c9a0c9c4092420091003 with: use: true - name: Login to GHCR uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Join both platforms of ${{ matrix.distro }} under the release tags env: OWNER: ${{ github.repository_owner }} VERSION: ${{ needs.prepare.outputs.version }} IS_STABLE: ${{ needs.prepare.outputs.is_stable }} PKGMGR_DISTRO: ${{ matrix.distro }} run: bash scripts/github/publish-containers/merge-container-images.sh