name: Publish container images (GHCR) on: workflow_run: workflows: ["Mark stable commit"] types: [completed] schedule: - cron: "0 3 * * *" workflow_dispatch: jobs: prepare: if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest permissions: contents: read outputs: releases: ${{ steps.info.outputs.releases }} steps: - name: Checkout repository (with tags) uses: actions/checkout@v7 with: fetch-depth: 0 - name: Resolve the releases this run publishes id: info env: WORKFLOW_RUN_SHA: ${{ github.event.workflow_run.head_sha }} run: bash scripts/github/publish-containers/compute-publish-container-info.sh build: needs: prepare if: ${{ needs.prepare.result == 'success' && needs.prepare.outputs.releases != '[]' }} name: Build ${{ matrix.distro }} ${{ matrix.release.version }} for ${{ matrix.target.platform }} 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 release: ${{ fromJSON(needs.prepare.outputs.releases) }} steps: - name: Checkout ${{ matrix.release.version }} uses: actions/checkout@v7 with: ref: ${{ matrix.release.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 }} ${{ matrix.release.version }} for ${{ matrix.target.platform }} env: OWNER: ${{ github.repository_owner }} VERSION: ${{ matrix.release.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.result == 'success' && needs.prepare.outputs.releases != '[]' }} name: Merge ${{ matrix.distro }} ${{ matrix.release.version }} runs-on: ubuntu-latest permissions: contents: read packages: write strategy: fail-fast: false matrix: distro: *distros release: ${{ fromJSON(needs.prepare.outputs.releases) }} steps: - name: Checkout ${{ matrix.release.version }} uses: actions/checkout@v7 with: ref: ${{ matrix.release.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 }} ${{ matrix.release.version }} under its tags env: OWNER: ${{ github.repository_owner }} VERSION: ${{ matrix.release.version }} ALIASES: ${{ matrix.release.aliases }} PKGMGR_DISTRO: ${{ matrix.distro }} run: bash scripts/github/publish-containers/merge-container-images.sh