Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

permissions: {}

jobs:
versions:
runs-on: ubuntu-latest
Expand All @@ -14,6 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
- name: Collect available versions
Expand All @@ -37,11 +40,14 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ matrix.revision }}

- name: Compute implementation name
id: impl
run: echo "name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
env:
GH_REPOSITORY: ${{ github.repository }}
run: echo "name=$(echo ${GH_REPOSITORY} | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT

- name: Install bowtie
uses: bowtie-json-schema/bowtie@main
Expand All @@ -65,20 +71,26 @@ jobs:
echo "DOCKER_HOST=unix://$(podman info --format '{{.Host.RemoteSocket.Path}}')" >> $GITHUB_ENV

- name: Smoke Test
env:
IMAGE_WITH_TAG: ${{ steps.build_image.outputs.image-with-tag }}
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
bowtie smoke -i "localhost/${IMAGE_WITH_TAG}" --format json
bowtie smoke -i "localhost/${IMAGE_WITH_TAG}" --format markdown >> $GITHUB_STEP_SUMMARY

- name: Collect current version
id: current-version
env:
IMAGE_WITH_TAG: ${{ steps.build_image.outputs.image-with-tag }}
run: |
version=$(bowtie info \
--implementation "localhost/${{ steps.build_image.outputs.image-with-tag }}" \
--implementation "localhost/${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 }}"
env:
CURRENT_VERSION: ${{ steps.current-version.outputs.value }}
run: echo "current_version=${CURRENT_VERSION}"

- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
Expand All @@ -88,7 +100,10 @@ jobs:
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 }}
env:
IMAGE_WITH_TAG: ${{ steps.build_image.outputs.image-with-tag }}
IMAGE_WITH_VERSION: "${{ steps.build_image.outputs.image }}:${{ steps.current-version.outputs.value }}"
run: podman tag ${IMAGE_WITH_TAG} ${IMAGE_WITH_VERSION}

- name: Publish
id: push
Expand Down
39 changes: 30 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ concurrency:
group: images-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
meta:
runs-on: ubuntu-latest
Expand All @@ -22,19 +24,25 @@ jobs:
implementation-name: ${{ steps.impl.outputs.name }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install bowtie
uses: bowtie-json-schema/bowtie@main

- name: Compute implementation name
id: impl
run: echo "name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
env:
GH_REPOSITORY: ${{ github.repository }}
run: echo "name=$(echo ${GH_REPOSITORY} | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT

- name: Compute latest implementation version
id: version
env:
IMPL_NAME: ${{ steps.impl.outputs.name }}
run: |
version=$(bowtie info \
--implementation ${{ steps.impl.outputs.name }} \
--implementation ${IMPL_NAME} \
--format json | jq -r '.version // empty')
echo "value=${version}" >> $GITHUB_OUTPUT

Expand All @@ -54,6 +62,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install bowtie
uses: bowtie-json-schema/bowtie@main
Expand Down Expand Up @@ -82,20 +92,27 @@ jobs:
enable-cache: true

- name: Smoke Test
env:
IMAGE_WITH_TAG: ${{ steps.build_image.outputs.image-with-tag }}
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
bowtie smoke -i "localhost/${IMAGE_WITH_TAG}" --format json
bowtie smoke -i "localhost/${IMAGE_WITH_TAG}" --format markdown >> $GITHUB_STEP_SUMMARY

- name: Collect current version
id: current-version
env:
IMAGE_WITH_TAG: ${{ steps.build_image.outputs.image-with-tag }}
run: |
version=$(bowtie info \
--implementation "localhost/${{ steps.build_image.outputs.image-with-tag }}" \
--implementation "localhost/${IMAGE_WITH_TAG}" \
--format json | jq -r '.version // empty')
echo "value=${version}" >> $GITHUB_OUTPUT

- name: Print collected versions
run: echo "latest_version=${{ needs.meta.outputs.latest-version }}; current_version=${{ steps.current-version.outputs.value }}"
env:
LATEST_VERSION: ${{ needs.meta.outputs.latest-version }}
CURRENT_VERSION: ${{ steps.current-version.outputs.value }}
run: echo "latest_version=${LATEST_VERSION}; current_version=${CURRENT_VERSION}"

- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
Expand All @@ -106,7 +123,10 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

- 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 }}
env:
IMAGE_WITH_TAG: ${{ steps.build_image.outputs.image-with-tag }}
IMAGE_WITH_VERSION: "${{ steps.build_image.outputs.image }}:${{ steps.current-version.outputs.value }}"
run: podman tag ${IMAGE_WITH_TAG} ${IMAGE_WITH_VERSION}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

- name: Publish
Expand Down Expand Up @@ -138,6 +158,7 @@ jobs:
env:
TAG: v${{ needs.meta.outputs.latest-version }}
COMMIT: ${{ github.event.before }}
GH_REPOSITORY: ${{ github.repository }}

steps:

Expand All @@ -150,7 +171,7 @@ jobs:
--method POST
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
/repos/${{ github.repository }}/git/refs
/repos/${GH_REPOSITORY}/git/refs
-f "ref=refs/tags/$TAG"
-f "sha=$COMMIT"

Expand All @@ -162,7 +183,7 @@ jobs:
--method POST
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
/repos/${{ github.repository }}/releases
/repos/${GH_REPOSITORY}/releases
-f "tag_name=$TAG"
-f "name=$TAG"
-f "body=Automatic release for $TAG"
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ repos:
- id: mixed-line-ending
args: [--fix, lf]
- id: trailing-whitespace
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.4.1
hooks:
- id: zizmor

# test harness specific hooks
- repo: https://github.com/dustinsand/pre-commit-jvm
Expand Down
Loading