|
1 | 1 | name: Build
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - release: |
5 |
| - types: |
6 |
| - - created |
7 |
| - |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '(pre)?release-v[0-9]+.[0-9]+.[0-9]+' |
8 | 7 | jobs:
|
9 | 8 | build_wheels:
|
10 | 9 | name: Build wheels on ${{ matrix.os }}
|
|
16 | 15 |
|
17 | 16 | steps:
|
18 | 17 | - uses: actions/checkout@v4
|
19 |
| - |
20 | 18 | - name: Build wheels
|
21 | 19 |
|
22 | 20 | env:
|
|
42 | 40 | with:
|
43 | 41 | name: cibw-sdist
|
44 | 42 | path: dist/*.tar.gz
|
| 43 | + create_release: |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - name: Get the tag name and determine if it's a prerelease |
| 47 | + id: get_tag_info |
| 48 | + run: | |
| 49 | + FULL_TAG=${GITHUB_REF#refs/tags/} |
| 50 | + if [[ $FULL_TAG == release-* ]]; then |
| 51 | + TAG_NAME=${FULL_TAG#release-} |
| 52 | + IS_PRERELEASE=false |
| 53 | + elif [[ $FULL_TAG == prerelease-* ]]; then |
| 54 | + TAG_NAME=${FULL_TAG#prerelease-} |
| 55 | + IS_PRERELEASE=true |
| 56 | + else |
| 57 | + echo "Tag does not match expected patterns" >&2 |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + echo "FULL_TAG=$TAG_NAME" >> $GITHUB_ENV |
| 61 | + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV |
| 62 | + echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV |
| 63 | + - name: Create Draft Release |
| 64 | + id: create_release |
| 65 | + uses: actions/create-release@v1 |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + with: |
| 69 | + tag_name: ${{ env.FULL_TAG }} |
| 70 | + release_name: ${{ env.TAG_NAME }} |
| 71 | + draft: true |
| 72 | + prerelease: ${{ env.IS_PRERELEASE }} |
45 | 73 | # After the build has finished, download the artifacts from the action
|
46 | 74 | # and upload them to the release. When we publish the release, the
|
47 | 75 | # assets will be downloaded from it and uploaded to PyPi.
|
|
65 | 93 | path: dist
|
66 | 94 | merge-multiple: true
|
67 | 95 | - uses: alexellis/[email protected]
|
| 96 | + # The action fetches the release from the tag ref |
68 | 97 | env:
|
69 | 98 | GITHUB_TOKEN: ${{ github.token }}
|
70 | 99 | with:
|
|
0 commit comments