|
42 | 42 | steps: |
43 | 43 | - run: echo 'The Publish workflow passed or was manually triggered' |
44 | 44 |
|
45 | | - sdist: |
| 45 | + validate-release-tag: |
46 | 46 | runs-on: ubuntu-latest |
47 | 47 | needs: [check-cargo-publish] |
| 48 | + steps: |
| 49 | + - name: Validate release tag format |
| 50 | + # Note, `workflow_run.head_branch` does not contain `refs/tags/` prefix, just the tag name, i.e. `v0.4.0` or `v0.4.0-rc.1` |
| 51 | + # Valid formats: v<major>.<minor>.<patch> OR v<major>.<minor>.<patch>-rc.<release_candidate> |
| 52 | + run: | |
| 53 | + RELEASE_TAG="${{ github.event.workflow_run.head_branch }}" |
| 54 | + echo "Validating release tag: $RELEASE_TAG" |
| 55 | + if [[ ! "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$ ]]; then |
| 56 | + echo "❌ Invalid release tag format: $RELEASE_TAG" |
| 57 | + echo "Expected format: v<major>.<minor>.<patch> OR v<major>.<minor>.<patch>-rc.<release_candidate>" |
| 58 | + echo "Examples: v0.4.0, v1.2.3-rc.1" |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | + echo "✅ Release tag format is valid: $RELEASE_TAG" |
| 62 | +
|
| 63 | + sdist: |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: [validate-release-tag] |
48 | 66 | steps: |
49 | 67 | - uses: actions/checkout@v4 |
50 | 68 | - uses: PyO3/maturin-action@v1 |
|
60 | 78 |
|
61 | 79 | wheels: |
62 | 80 | runs-on: "${{ matrix.os }}" |
63 | | - needs: [check-cargo-publish] |
| 81 | + needs: [validate-release-tag] |
64 | 82 | strategy: |
65 | 83 | matrix: |
66 | 84 | include: |
@@ -108,17 +126,6 @@ jobs: |
108 | 126 | id-token: write # IMPORTANT: mandatory for trusted publishing |
109 | 127 |
|
110 | 128 | steps: |
111 | | - - name: Validate release tag format |
112 | | - # Note, `workflow_run.head_branch` does not contain `refs/tags/` prefix, just the tag name, i.e. `v0.4.0` or `v0.4.0-rc.1` |
113 | | - run: | |
114 | | - RELEASE_TAG="${{ github.event.workflow_run.head_branch }}" |
115 | | - echo "Validating release tag: $RELEASE_TAG" |
116 | | - if [[ ! "$RELEASE_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)? ]]; then |
117 | | - echo "❌ Invalid release tag format: $RELEASE_TAG" |
118 | | - exit 1 |
119 | | - fi |
120 | | - echo "✅ Release tag format is valid" |
121 | | -
|
122 | 129 | - name: Download all the dists |
123 | 130 | uses: actions/download-artifact@v4 |
124 | 131 | with: |
|
0 commit comments