Skip to content

Commit 050951e

Browse files
committed
Update cibuildwheel.yml to use release-v* tag semantics
Align with thinc's workflow: trigger only on release-v*/prerelease-v* tags instead of branch pushes/PRs, pin the reusable workflow to a specific SHA, remove the now-unnecessary create-release input, and add the retag_release job that re-points the draft release to a clean v* tag.
1 parent d2fab6e commit 050951e

1 file changed

Lines changed: 42 additions & 13 deletions

File tree

.github/workflows/cibuildwheel.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,56 @@
1-
name: Build wheels
1+
name: Build
22

3-
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: ["*"]
8-
workflow_dispatch: # allows you to trigger manually
9-
10-
# When this workflow is queued, automatically cancel any previous running
11-
# or pending jobs from the same branch
123
concurrency:
13-
group: Build-${{ github.ref }}
4+
group: ${{ github.workflow }}
145
cancel-in-progress: true
156

7+
on:
8+
push:
9+
tags:
10+
# ytf did they invent their own syntax that's almost regex?
11+
# ** matches 'zero or more of any character'
12+
- 'release-v[0-9]+.[0-9]+.[0-9]+**'
13+
- 'prerelease-v[0-9]+.[0-9]+.[0-9]+**'
1614
jobs:
1715
build_wheels:
18-
uses: explosion/gha-cibuildwheel/.github/workflows/cibuildwheel.yml@main
16+
uses: explosion/gha-cibuildwheel/.github/workflows/cibuildwheel.yml@2c98f757f13d112cf73fcf4b627249f1fffb5aae # main
1917
permissions:
2018
contents: write
2119
actions: read
2220
with:
2321
wheel-name-pattern: "srsly-*.whl"
2422
pure-python: true
25-
create-release: ${{ startsWith(github.ref, 'refs/tags/release-') || startsWith(github.ref, 'refs/tags/prerelease-') }}
2623
secrets:
2724
gh-token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
retag_release:
27+
needs: build_wheels
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
steps:
32+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
33+
- name: Retag release from release-v* to v*
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
# Strip release- or prerelease- prefix to get the v* tag
38+
TRIGGER_TAG="${GITHUB_REF_NAME}"
39+
if [[ "$TRIGGER_TAG" == release-* ]]; then
40+
VERSION_TAG="${TRIGGER_TAG#release-}"
41+
elif [[ "$TRIGGER_TAG" == prerelease-* ]]; then
42+
VERSION_TAG="${TRIGGER_TAG#prerelease-}"
43+
else
44+
echo "Unexpected tag format: $TRIGGER_TAG"
45+
exit 1
46+
fi
47+
48+
# Create the v* tag on the same commit
49+
git tag "$VERSION_TAG" "$GITHUB_SHA"
50+
git push origin "$VERSION_TAG"
51+
52+
# Re-point the draft release to the v* tag
53+
gh release edit "$TRIGGER_TAG" --tag "$VERSION_TAG"
54+
55+
# Delete the trigger tag
56+
git push origin --delete "$TRIGGER_TAG"

0 commit comments

Comments
 (0)