v0.1.0-sai-worker #36
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Publish Multi-Arch Images (Quay.io) | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: quay.io | |
| NAMESPACE: hackers4peace | |
| TAG: ${{ github.sha }} | |
| QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | |
| QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} | |
| # Space-separated list of flake image attributes | |
| IMAGE_ATTRS: | | |
| sai-oxigraph-image | |
| sai-id-image | |
| sai-css-image | |
| sai-worker-image | |
| jobs: | |
| build-and-publish: | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - system: x86_64-linux | |
| arch: amd64 | |
| runner: ubuntu-latest | |
| - system: aarch64-linux | |
| arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Dagger | |
| uses: dagger/dagger-for-github@v7 | |
| with: | |
| version: latest | |
| cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
| - name: Build & publish images (${{ matrix.arch }}) | |
| run: | | |
| dagger call publish-images \ | |
| --system "${{ matrix.system }}" \ | |
| $(for image in $IMAGE_ATTRS; do printf -- "--images %s " "$image"; done) \ | |
| --registry "$REGISTRY" \ | |
| --namespace "$NAMESPACE" \ | |
| --tag "$TAG" \ | |
| --username=env://QUAY_USERNAME \ | |
| --password=env://QUAY_TOKEN | |
| publish-manifests: | |
| runs-on: ubuntu-latest | |
| needs: build-and-publish | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Podman | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y podman | |
| - name: Publish multi-arch manifests (Podman) | |
| run: | | |
| AUTHFILE="$RUNNER_TEMP/podman-auth.json" | |
| podman login quay.io \ | |
| --authfile "$AUTHFILE" \ | |
| -u "$QUAY_USERNAME" \ | |
| -p "$QUAY_TOKEN" | |
| for image in $IMAGE_ATTRS; do | |
| name="${image%-image}" | |
| target="${NAMESPACE}/${name}:${TAG}" | |
| podman manifest create "$target" | |
| podman manifest add \ | |
| --authfile "$AUTHFILE" \ | |
| "$target" \ | |
| "docker://${REGISTRY}/${NAMESPACE}/${name}:${TAG}-amd64" \ | |
| "docker://${REGISTRY}/${NAMESPACE}/${name}:${TAG}-arm64" | |
| podman manifest push \ | |
| --all \ | |
| --authfile "$AUTHFILE" \ | |
| "$target" \ | |
| "docker://${REGISTRY}/${NAMESPACE}/${name}:${TAG}" | |
| done |