|
1 | | -name: Build wheels |
| 1 | +name: Build |
2 | 2 |
|
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 |
12 | 3 | concurrency: |
13 | | - group: Build-${{ github.ref }} |
| 4 | + group: ${{ github.workflow }} |
14 | 5 | cancel-in-progress: true |
15 | 6 |
|
| 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]+**' |
16 | 14 | jobs: |
17 | 15 | build_wheels: |
18 | | - uses: explosion/gha-cibuildwheel/.github/workflows/cibuildwheel.yml@main |
| 16 | + uses: explosion/gha-cibuildwheel/.github/workflows/cibuildwheel.yml@2c98f757f13d112cf73fcf4b627249f1fffb5aae # main |
19 | 17 | permissions: |
20 | 18 | contents: write |
21 | 19 | actions: read |
22 | 20 | with: |
23 | 21 | wheel-name-pattern: "srsly-*.whl" |
24 | 22 | pure-python: true |
25 | | - create-release: ${{ startsWith(github.ref, 'refs/tags/release-') || startsWith(github.ref, 'refs/tags/prerelease-') }} |
26 | 23 | secrets: |
27 | 24 | 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