Skip to content

[pre-commit.ci] pre-commit autoupdate (add zizmor config to allow ref-pinned actions) #155

[pre-commit.ci] pre-commit autoupdate (add zizmor config to allow ref-pinned actions)

[pre-commit.ci] pre-commit autoupdate (add zizmor config to allow ref-pinned actions) #155

Workflow file for this run

name: Rebuild Bowtie Image
on:
workflow_dispatch:
pull_request:
push:
branches-ignore:
- "wip*"
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
concurrency:
group: images-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
meta:
runs-on: ubuntu-latest
outputs:
latest-version: ${{ steps.version.outputs.value }}
steps:
- name: Install bowtie
uses: bowtie-json-schema/bowtie@main
- name: Compute implementation name
id: impl
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 ${IMPL_NAME} \
--format json | jq -r '.version // empty')
echo "value=${version}" >> $GITHUB_OUTPUT
echo "Latest version: $version"
build:
needs: meta
permissions:
id-token: write
contents: read
attestations: write
packages: write
uses: ./.github/workflows/build-image.yml
with:
is-latest: ${{ github.ref == 'refs/heads/main' }}
publish-image: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
mark-previous-version:
needs: [build, meta, automerge]
runs-on: ubuntu-latest
if: |
(
(github.event_name == 'push' && github.ref == 'refs/heads/main')
|| (github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]')
)
&& needs.build.outputs.current-version != needs.meta.outputs.latest-version
&& !cancelled()
permissions:
contents: write
env:
TAG: v${{ needs.meta.outputs.latest-version }}
COMMIT: ${{ github.event.pull_request.base.sha || github.event.before }} # either the PR base ref or previous commit in the branch
GH_REPOSITORY: ${{ github.repository }}
steps:
- name: Create a release for previous implementation version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh api
--method POST
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
/repos/${GH_REPOSITORY}/releases
-f "tag_name=$TAG"
-f "target_commitish=$COMMIT"
-f "name=$TAG"
-f "body=Automatic release for $TAG"
-F "generate_release_notes=true"
automerge:
needs: build
runs-on: ubuntu-latest
if: (!cancelled() && github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]')
permissions:
contents: write
pull-requests: write
steps:
- name: Automatically merge allowed PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}