Skip to content

docs(ci): update workflow docs - detect-quota, hosted-first fallback,… #215

docs(ci): update workflow docs - detect-quota, hosted-first fallback,…

docs(ci): update workflow docs - detect-quota, hosted-first fallback,… #215

Workflow file for this run

name: Docker CI
on:
push:
pull_request:
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
detect-quota:
# Probe the hosted runner to decide whether to use hosted runners or
# fall back to self-hosted. Use the same runner flavor as the original
# try job.
runs-on: ubuntu-latest
steps:
- name: Quota probe
id: quota_probe
run: |
echo "probe"
# NOTE: Do not set `continue-on-error: true` on the `detect-quota` job.
# If `continue-on-error` is enabled the job result will always be
# 'success', which defeats detection (we rely on `needs.detect-quota.result`).
# Unfortunately this means the workflow may be reported as failed if the
# hosted runner is unavailable. We cannot work around this until GitHub
# provides a job-level "allow-failure"/neutral-conclusion feature
# (see: https://github.com/actions/runner/issues/2347 for discussion).
docker:
needs: detect-quota
if: ${{ always() }}
runs-on: ${{ needs.detect-quota.result == 'success' && 'ubuntu-latest' || 'self-hosted' }}
continue-on-error: true
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=ref,event=branch
type=ref,event=pr
test
- name: Build and Push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}