Update cibuildwheel.yml to use release-v* tag semantics #20
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| tags: | |
| # ytf did they invent their own syntax that's almost regex? | |
| # ** matches 'zero or more of any character' | |
| - 'release-v[0-9]+.[0-9]+.[0-9]+**' | |
| - 'prerelease-v[0-9]+.[0-9]+.[0-9]+**' | |
| jobs: | |
| build_wheels: | |
| uses: explosion/gha-cibuildwheel/.github/workflows/cibuildwheel.yml@2c98f757f13d112cf73fcf4b627249f1fffb5aae # main | |
| permissions: | |
| contents: write | |
| actions: read | |
| with: | |
| wheel-name-pattern: "srsly-*.whl" | |
| pure-python: true | |
| secrets: | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} | |
| retag_release: | |
| needs: build_wheels | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Retag release from release-v* to v* | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Strip release- or prerelease- prefix to get the v* tag | |
| TRIGGER_TAG="${GITHUB_REF_NAME}" | |
| if [[ "$TRIGGER_TAG" == release-* ]]; then | |
| VERSION_TAG="${TRIGGER_TAG#release-}" | |
| elif [[ "$TRIGGER_TAG" == prerelease-* ]]; then | |
| VERSION_TAG="${TRIGGER_TAG#prerelease-}" | |
| else | |
| echo "Unexpected tag format: $TRIGGER_TAG" | |
| exit 1 | |
| fi | |
| # Create the v* tag on the same commit | |
| git tag "$VERSION_TAG" "$GITHUB_SHA" | |
| git push origin "$VERSION_TAG" | |
| # Re-point the draft release to the v* tag | |
| gh release edit "$TRIGGER_TAG" --tag "$VERSION_TAG" | |
| # Delete the trigger tag | |
| git push origin --delete "$TRIGGER_TAG" |