Skip to content

Commit 401d87b

Browse files
Add workflow to rebuild all available old version and the latest one (#2)
This commit also adds `--platform=$BUILDPLATFORM` into Dockerfile to enable multi-arch builds without QEMU --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 81750f1 commit 401d87b

File tree

3 files changed

+107
-6
lines changed

3 files changed

+107
-6
lines changed

.github/workflows/build-all.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Build Bowtie Image for all available versions
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
8+
9+
jobs:
10+
versions:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
revisions: ${{ steps.revisions.outputs.value }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
fetch-tags: true
19+
- name: Collect available versions
20+
id: revisions
21+
run: |
22+
tags=$(jq -c -n '$ARGS.positional + ["main"]' --args $(git tag --list))
23+
echo "value=$(echo $tags | jq -c .)" >> $GITHUB_OUTPUT
24+
25+
build:
26+
needs: versions
27+
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: true
30+
matrix:
31+
revision: ${{ fromJson(needs.versions.outputs.revisions) }}
32+
permissions:
33+
id-token: write
34+
contents: read
35+
attestations: write
36+
packages: write
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
ref: ${{ matrix.revision }}
41+
42+
- name: Compute implementation name
43+
id: impl
44+
run: echo "name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
45+
46+
- name: Install bowtie
47+
uses: bowtie-json-schema/bowtie@main
48+
49+
- name: Build
50+
id: build_image
51+
uses: redhat-actions/buildah-build@v2
52+
with:
53+
context: '.'
54+
containerfiles: |
55+
Dockerfile
56+
image: ${{ steps.impl.outputs.name }}
57+
tags: ${{ github.sha }} ${{ matrix.revision == 'main' && 'latest' || '' }}
58+
archs: amd64, arm64
59+
60+
- name: Set DOCKER_HOST so podman-built images are findable
61+
run: |
62+
systemctl --user enable --now podman.socket
63+
sudo loginctl enable-linger $USER
64+
podman --remote info
65+
echo "DOCKER_HOST=unix://$(podman info --format '{{.Host.RemoteSocket.Path}}')" >> $GITHUB_ENV
66+
67+
- name: Smoke Test
68+
run: |
69+
bowtie smoke -i "localhost/${{ steps.build_image.outputs.image-with-tag }}" --format json
70+
bowtie smoke -i "localhost/${{ steps.build_image.outputs.image-with-tag }}" --format markdown >> $GITHUB_STEP_SUMMARY
71+
72+
- name: Collect current version
73+
id: current-version
74+
run: |
75+
version=$(bowtie info \
76+
--implementation "localhost/${{ steps.build_image.outputs.image-with-tag }}" \
77+
--format json | jq -r '.version // empty')
78+
echo "value=${version}" >> $GITHUB_OUTPUT
79+
80+
- name: Print collected version
81+
run: echo "current_version=${{ steps.current-version.outputs.value }}"
82+
83+
- name: Log in to ghcr.io
84+
uses: redhat-actions/podman-login@v1
85+
with:
86+
username: ${{ github.actor }}
87+
password: ${{ github.token }}
88+
registry: ${{ env.IMAGE_REGISTRY }}
89+
90+
- name: Add tag with version to the image
91+
run: podman tag ${{ steps.build_image.outputs.image-with-tag }} ${{ steps.build_image.outputs.image }}:${{ steps.current-version.outputs.value }}
92+
93+
- name: Publish
94+
id: push
95+
uses: redhat-actions/push-to-registry@v2
96+
with:
97+
image: ${{ steps.build_image.outputs.image }}
98+
tags: ${{ steps.current-version.outputs.value }} ${{ steps.build_image.outputs.tags }}
99+
registry: ${{ env.IMAGE_REGISTRY }}
100+
101+
- name: Generate attestation for images
102+
uses: actions/attest-build-provenance@v2
103+
with:
104+
subject-name: ${{ env.IMAGE_REGISTRY }}/${{ steps.build_image.outputs.image }}
105+
subject-digest: ${{ steps.push.outputs.digest }}
106+
push-to-registry: true

.github/workflows/build.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ jobs:
5858
- name: Install bowtie
5959
uses: bowtie-json-schema/bowtie@main
6060

61-
- name: Install qemu
62-
run: |
63-
sudo apt-get update
64-
sudo apt-get install -y qemu-user-static
65-
6661
- name: Build
6762
id: build_image
6863
uses: redhat-actions/buildah-build@v2

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM gradle:8.12.1-jdk17 AS builder
1+
FROM --platform=$BUILDPLATFORM gradle:8.12.1-jdk17 AS builder
22
WORKDIR /opt/app
33
COPY gradle/libs.versions.toml gradle/
44
COPY settings.gradle.kts .

0 commit comments

Comments
 (0)