Build all OpenAMI images (multi-arch, strict) #55
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 all OpenAMI images (multi-arch, strict) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - "openami/**" | |
| - "scripts/discover-build-matrix.sh" | |
| - ".github/workflows/build-all.yml" | |
| schedule: | |
| - cron: "0 2 * * *" # nightly | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: build-openami-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| discover: | |
| name: Discover images and tags | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.discover.outputs.matrix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Initialize tags (best-effort) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| chmod +x scripts/init-tags.sh | |
| OPENAMI_DIR=openami scripts/init-tags.sh | |
| - name: Matrix discovery (strict) | |
| id: discover | |
| shell: bash | |
| env: | |
| OPENAMI_DIR: openami | |
| STRICT_MISSING: "true" | |
| run: | | |
| set -euo pipefail | |
| chmod +x scripts/discover-build-matrix.sh | |
| scripts/discover-build-matrix.sh >> "$GITHUB_OUTPUT" | |
| build: | |
| name: Build and push | |
| needs: discover | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.discover.outputs.matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| install: true | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push ${{ matrix.name }}:${{ matrix.tag }} | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ${{ matrix.context }} | |
| file: ${{ matrix.dockerfile }} | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ghcr.io/devthefuture-org/containers/${{ matrix.name }}:${{ matrix.tag }} | |
| build-args: | | |
| TAG=${{ matrix.tag }} | |
| labels: | | |
| org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| org.opencontainers.image.created=${{ github.run_id }} | |
| cache-from: type=gha,scope=${{ matrix.name }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.name }} | |
| - name: Trivy scan (warn only) | |
| uses: aquasecurity/[email protected] | |
| with: | |
| image-ref: ghcr.io/devthefuture-org/containers/${{ matrix.name }}@${{ steps.build.outputs.digest }} | |
| format: table | |
| severity: CRITICAL,HIGH | |
| ignore-unfixed: true | |
| vuln-type: os,library | |
| exit-code: "0" # warn-only | |
| timeout: "15m" |