|
8 | 8 | pull_request: |
9 | 9 | branches: [master, main] |
10 | 10 | workflow_dispatch: |
| 11 | + inputs: |
| 12 | + release_tag: |
| 13 | + description: 'Release tag (e.g., v0.1.0) - triggers release + publish' |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + skip_tests: |
| 17 | + description: 'Skip test jobs' |
| 18 | + required: false |
| 19 | + type: boolean |
| 20 | + default: false |
11 | 21 |
|
12 | 22 | env: |
13 | 23 | CARGO_TERM_COLOR: always |
@@ -137,6 +147,7 @@ jobs: |
137 | 147 |
|
138 | 148 | # Test the builds |
139 | 149 | test: |
| 150 | + if: ${{ !inputs.skip_tests }} |
140 | 151 | needs: build |
141 | 152 | strategy: |
142 | 153 | fail-fast: false |
@@ -180,7 +191,7 @@ jobs: |
180 | 191 |
|
181 | 192 | # Create release on tag |
182 | 193 | release: |
183 | | - if: startsWith(github.ref, 'refs/tags/v') |
| 194 | + if: ${{ always() && !cancelled() && !failure() && (startsWith(github.ref, 'refs/tags/v') || inputs.release_tag != '') }} |
184 | 195 | needs: [build, universal-macos, test] |
185 | 196 | runs-on: ubuntu-latest |
186 | 197 | name: Create Release |
@@ -215,16 +226,17 @@ jobs: |
215 | 226 | # softprops/action-gh-release@v2 |
216 | 227 | uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b |
217 | 228 | with: |
| 229 | + tag_name: ${{ inputs.release_tag || github.ref_name }} |
218 | 230 | files: release/* |
219 | 231 | generate_release_notes: true |
220 | 232 | draft: false |
221 | | - prerelease: ${{ contains(github.ref, '-') }} |
| 233 | + prerelease: ${{ contains(inputs.release_tag || github.ref, '-') }} |
222 | 234 | env: |
223 | 235 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
224 | 236 |
|
225 | 237 | # Optional: Publish to npm |
226 | 238 | publish: |
227 | | - if: startsWith(github.ref, 'refs/tags/v') |
| 239 | + if: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.release_tag != '' }} |
228 | 240 | needs: [release] |
229 | 241 | runs-on: ubuntu-latest |
230 | 242 | name: Publish to npm |
|
0 commit comments