|
1 | | -name: Publish to TestPyPI |
| 1 | +name: Publish Pre-Release to TestPyPI |
2 | 2 |
|
3 | 3 | on: workflow_dispatch |
4 | 4 |
|
|
20 | 20 | id-token: write # For trusted publishing |
21 | 21 |
|
22 | 22 | steps: |
23 | | - - name: Generate unique name for the test release |
24 | | - id: create_release_name |
25 | | - run: echo "RELEASE_NAME=test-release-`date -Is --utc`" >> $GITHUB_OUTPUT |
26 | | - |
27 | 23 | - name: Checkout repository |
28 | 24 | uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
29 | 25 | with: |
|
37 | 33 | - name: Install Hatch |
38 | 34 | run: pip install --upgrade hatch |
39 | 35 |
|
| 36 | + - name: Generate new pre-release version number |
| 37 | + id: create_version_number |
| 38 | + run: | |
| 39 | + # Convert current version number to an alpha release of the next version. |
| 40 | + # For example, 1.0.2 becomes 1.0.3a0 |
| 41 | + hatch version micro,a |
| 42 | + # Get latest version number from test.pypi.org |
| 43 | + CURRENT_VERSION_NUMBER=$(pip index versions --pre --index-url https://test.pypi.org/simple seclab-taskflow-agent | sed 's/[^(]*[(]\([^)]*\)[)].*/\1/' | head -n 1) |
| 44 | + # Set version number to match test.pypi.org |
| 45 | + hatch version "$CURRENT_VERSION_NUMBER" || echo TestPyPI is behind current version |
| 46 | + # Bump version number |
| 47 | + hatch version a |
| 48 | + # Create a name for the release |
| 49 | + echo "RELEASE_NAME=test-release-v`hatch version`" >> $GITHUB_OUTPUT |
| 50 | +
|
40 | 51 | - name: Build the wheel |
41 | 52 | run: python3 -m hatch build |
42 | 53 |
|
|
62 | 73 | - name: Create GitHub Release |
63 | 74 | env: |
64 | 75 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
65 | | - RELEASE_NAME: ${{ steps.create_release_name.outputs.RELEASE_NAME }} |
| 76 | + RELEASE_NAME: ${{ steps.create_version_number.outputs.RELEASE_NAME }} |
66 | 77 | run: gh release create $RELEASE_NAME dist/* --repo $GITHUB_REPO --prerelease --generate-notes |
0 commit comments