catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
ci(bcr): name an attached release archive as the BCR source
- Commit
f8512a49fc1805a529e131b9bed58ea40ab0b267- Author
- Leitwolf11 ·
- Parents
ebad99d7aa31
Changes
.bcr/source.template.json | 4 ++-- .github/workflows/publish-to-bcr.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.bcr/source.template.json b/.bcr/source.template.json index e68c53b4..3c5b285c 100644 --- a/.bcr/source.template.json +++ b/.bcr/source.template.json @@ -1,5 +1,5 @@ { "integrity": "", - "strip_prefix": "{REPO}-{TAG}", - "url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz" + "strip_prefix": "catch3-{VERSION}", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/catch3-{VERSION}.tar.xz" } diff --git a/.github/workflows/publish-to-bcr.yml b/.github/workflows/publish-to-bcr.yml index beac20a0..797b537e 100644 --- a/.github/workflows/publish-to-bcr.yml +++ b/.github/workflows/publish-to-bcr.yml @@ -19,7 +19,38 @@ on: permissions: {} jobs: + # The registry rejects GitHub's tag archives as unstable, so the source the + # BCR entry names (.bcr/source.template.json) is attached to the release: + # `git archive` of the tag through `xz -9e -T1`, the recipe of the source + # archives on storage.catch3.uk. The entry's integrity is taken from the + # attached file itself, so its bytes need not match another xz's. + archive: + if: startsWith(github.event.release.tag_name || inputs.tag_name, 'catch3-') + runs-on: ubuntu-24.04 + permissions: + contents: write + env: + TAG: ${{ github.event.release.tag_name || inputs.tag_name }} + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ env.TAG }} + persist-credentials: false + - name: Attach the source archive + run: | + version="${TAG#catch3-}" + name="catch3-${version}.tar.xz" + if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' | grep -qx "$name"; then + echo "$name is already attached" + exit 0 + fi + git archive --format=tar --prefix="catch3-${version}/" "$TAG" | xz -9e -T1 -c > "$name" + sha256sum "$name" > "$name.sha256sums" + gh release upload "$TAG" "$name" "$name.sha256sums" --repo "$GITHUB_REPOSITORY" + publish: + needs: archive if: startsWith(github.event.release.tag_name || inputs.tag_name, 'catch3-') uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@3b1b972e41764b9a7498cf9128ed4ed2258a3687 # v1.6.0 with: