Try target platform as input for builder image #4
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 Bowtie Image for all available versions | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
jobs: | |
versions: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
revisions: ${{ steps.revisions.outputs.value }} | |
steps: | |
- name: Collect available versions | |
id: revisions | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
tags=$(gh api \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/releases | jq -c '. | map(.tag_name)') | |
echo "value=$(echo $tags | jq -c .)" >> $GITHUB_OUTPUT | |
build: | |
needs: versions | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
revision: ${{ fromJson(needs.versions.outputs.revisions) }} | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.revision }} | |
- name: Compute implementation name | |
id: impl | |
run: echo "name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT | |
- name: Install bowtie | |
uses: bowtie-json-schema/bowtie@main | |
- name: Build | |
id: build_image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
context: '.' | |
containerfiles: | | |
Dockerfile | |
image: ${{ steps.impl.outputs.name }} | |
tags: ${{ github.sha }} ${{ matrix.revision == 'main' && 'latest' || '' }} | |
archs: amd64, arm64 | |
- name: Set DOCKER_HOST so podman-built images are findable | |
run: | | |
systemctl --user enable --now podman.socket | |
sudo loginctl enable-linger $USER | |
podman --remote info | |
echo "DOCKER_HOST=unix://$(podman info --format '{{.Host.RemoteSocket.Path}}')" >> $GITHUB_ENV | |
- name: Smoke Test | |
run: | | |
bowtie smoke -i "localhost/${{ steps.build_image.outputs.image-with-tag }}" --format json | |
bowtie smoke -i "localhost/${{ steps.build_image.outputs.image-with-tag }}" --format markdown >> $GITHUB_STEP_SUMMARY | |
- name: Collect current version | |
id: current-version | |
run: | | |
version=$(bowtie info \ | |
--implementation "localhost/${{ steps.build_image.outputs.image-with-tag }}" \ | |
--format json | jq -r '.version // empty') | |
echo "value=${version}" >> $GITHUB_OUTPUT | |
- name: Print collected version | |
run: echo "current_version=${{ steps.current-version.outputs.value }}" | |
- name: Log in to ghcr.io | |
uses: redhat-actions/podman-login@v1 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
- name: Add tag with version to the image | |
run: podman tag ${{ steps.build_image.outputs.image-with-tag }} ${{ steps.build_image.outputs.image }}:${{ steps.current-version.outputs.value }} | |
- name: Publish | |
id: push | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build_image.outputs.image }} | |
tags: ${{ steps.current-version.outputs.value }} ${{ steps.build_image.outputs.tags }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
- name: Generate attestation for images | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-name: ${{ env.IMAGE_REGISTRY }}/${{ steps.build_image.outputs.image }} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |