3.3 KiB · text History 596a44f
# Builds the release images and pushes them to the forge's own OCI
# registry (ggr.neiam.co) on every push to master — the .gitlab-ci.yml
# kaniko jobs, moved off GitLab's registry (r.g.gmp.io), whose S3 storage
# refused every push from 2026-10-23 on, so no image was published.
#
# The images land at <registry>/<owner>/<repo>, i.e.
# ggr.neiam.co/neiam/oh-my-ex-oh-ircd, with the tags the GitLab jobs used: one
# build per TLS_MODE, each tagged <mode>-master and <mode>-<short sha>,
# and standalone also :master and :latest (most VPS-style deploys want
# the in-process ACME path). The argo Deployment (argo-01-bos/neiam-ircd)
# runs :kubernetes-master; keel polls for it.
#
# No secrets. The per-job token is accepted by the registry's /v2/token
# endpoint and authorized to push this repository's own image path.
name: image
on:
  push:
    branches: [master]
  workflow_dispatch:

# A newer push supersedes this run: on a branch the run in progress is
# cancelled; on master it finishes, and only a run still waiting is
# replaced.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
  image:
    if: github.server_url != 'https://github.com'
    strategy:
      matrix:
        tls_mode: [kubernetes, standalone]
    runs-on: arc-runner-set
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v4

      - uses: docker/setup-buildx-action@v3

      # An unset CI_REGISTRY resolves to the empty string, and
      # login-action then silently defaults to docker.io while
      # metadata-action builds a nonsense "/owner/repo" reference. Say
      # what is missing instead.
      - name: Check the registry variable is set
        env:
          CI_REGISTRY: ${{ vars.CI_REGISTRY }}
        run: |
          set -euo pipefail
          if [ -z "${CI_REGISTRY:-}" ]; then
            echo "CI_REGISTRY is not set for this repository." >&2
            exit 1
          fi
          echo "pushing to $CI_REGISTRY"

      # The username is ignored by the token endpoint but login-action
      # requires it to be non-empty.
      - uses: docker/login-action@v3
        with:
          registry: ${{ vars.CI_REGISTRY }}
          username: gitgud-actions
          password: ${{ github.token }}

      - uses: docker/metadata-action@v5
        id: meta
        with:
          images: ${{ vars.CI_REGISTRY }}/${{ github.repository }}
          flavor: latest=false
          tags: |
            type=raw,value=${{ matrix.tls_mode }}-master
            type=sha,prefix=${{ matrix.tls_mode }}-,format=short
            type=raw,value=master,enable=${{ matrix.tls_mode == 'standalone' }}
            type=raw,value=latest,enable=${{ matrix.tls_mode == 'standalone' }}

      - uses: docker/build-push-action@v6
        with:
          context: .
          file: ./Dockerfile
          build-args: TLS_MODE=${{ matrix.tls_mode }}
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache-${{ matrix.tls_mode }}
          cache-to: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache-${{ matrix.tls_mode }},mode=max