|
16 | 16 | - dev
|
17 | 17 | - 'release/**'
|
18 | 18 | - 'ci/**'
|
| 19 | + workflow_dispatch: |
| 20 | + inputs: |
| 21 | + target_branch: |
| 22 | + description: 'Branch to make a release of' |
| 23 | + required: true |
| 24 | + default: 'dev' |
19 | 25 |
|
20 | 26 | concurrency:
|
21 | 27 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
22 | 28 | cancel-in-progress: true
|
23 | 29 |
|
24 | 30 | env:
|
25 | 31 | # we only want to publish on "push to master" or alpha releases. When we don't want to publish, we want to upload artefacts
|
26 |
| - SHOULD_PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
27 |
| - SHOULD_PUBLISH_ALPHA: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') && contains(github.ref, '-alpha.') }} |
| 32 | + SHOULD_PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master'}} |
| 33 | + SHOULD_PUBLISH_ALPHA: ${{((github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') && contains(github.ref, '-alpha.'))) || (github.event_name == 'workflow_dispatch') }} |
28 | 34 |
|
29 | 35 | jobs:
|
| 36 | + create_draft_release_if_needed: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + env: |
| 39 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + outputs: |
| 41 | + version_tag: ${{ steps.get_version.outputs.VERSION_TAG }} |
| 42 | + steps: |
| 43 | + - name: Checkout git repo |
| 44 | + uses: actions/checkout@v4 |
| 45 | + # We only need a few files in this run, no point cloning everything |
| 46 | + with: |
| 47 | + sparse-checkout: | |
| 48 | + package.json |
| 49 | + build/release-notes.md |
| 50 | + build/release-notes-alpha.md |
| 51 | + sparse-checkout-cone-mode: false |
| 52 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
| 53 | + |
| 54 | + - name: Get version tag from package.json |
| 55 | + id: get_version |
| 56 | + run: | |
| 57 | + version=$(node -p "require('./package.json').version") |
| 58 | + echo "VERSION_TAG=$version" >> "$GITHUB_OUTPUT" |
| 59 | +
|
| 60 | + - name: Create draft release |
| 61 | + # only run this on "push" to "master" or alpha releases |
| 62 | + if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }} |
| 63 | + uses: ncipollo/release-action@v1 |
| 64 | + with: |
| 65 | + tag: v${{ steps.get_version.outputs.VERSION_TAG }} |
| 66 | + name: 'Session ${{ steps.get_version.outputs.VERSION_TAG }}' |
| 67 | + draft: true |
| 68 | + bodyFile: ${{ env.SHOULD_PUBLISH_ALPHA == 'true' && 'build/release-notes-alpha.md' || 'build/release-notes.md' }} |
| 69 | + allowUpdates: true |
| 70 | + skipIfReleaseExists: true |
| 71 | + omitBodyDuringUpdate: true |
| 72 | + omitDraftDuringUpdate: true |
| 73 | + omitNameDuringUpdate: true |
| 74 | + omitPrereleaseDuringUpdate: true |
| 75 | + |
30 | 76 | build_linux:
|
31 | 77 | runs-on: ubuntu-22.04
|
32 | 78 | strategy:
|
|
42 | 88 |
|
43 | 89 | - name: Checkout git repo
|
44 | 90 | uses: actions/checkout@v4
|
| 91 | + with: |
| 92 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
45 | 93 |
|
46 | 94 | - name: Setup & Build
|
47 | 95 | uses: ./actions/setup_and_build
|
@@ -114,6 +162,7 @@ jobs:
|
114 | 162 | build/release-notes.md
|
115 | 163 | build/release-notes-alpha.md
|
116 | 164 | sparse-checkout-cone-mode: false
|
| 165 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
117 | 166 |
|
118 | 167 | - name: Get version tag from package.json
|
119 | 168 | id: get_version
|
@@ -163,6 +212,8 @@ jobs:
|
163 | 212 |
|
164 | 213 | - name: Checkout git repo
|
165 | 214 | uses: actions/checkout@v4
|
| 215 | + with: |
| 216 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
166 | 217 |
|
167 | 218 | - name: Setup & Build
|
168 | 219 | uses: ./actions/setup_and_build
|
@@ -206,6 +257,8 @@ jobs:
|
206 | 257 |
|
207 | 258 | - name: Checkout git repo
|
208 | 259 | uses: actions/checkout@v4
|
| 260 | + with: |
| 261 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
209 | 262 |
|
210 | 263 | - name: Setup & Build
|
211 | 264 | uses: ./actions/setup_and_build
|
@@ -236,6 +289,8 @@ jobs:
|
236 | 289 |
|
237 | 290 | - name: Checkout git repo
|
238 | 291 | uses: actions/checkout@v4
|
| 292 | + with: |
| 293 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
239 | 294 |
|
240 | 295 | - name: Setup & Build
|
241 | 296 | uses: ./actions/setup_and_build
|
@@ -265,14 +320,8 @@ jobs:
|
265 | 320 | sparse-checkout: |
|
266 | 321 | package.json
|
267 | 322 | build/setup-release-combine.sh
|
268 |
| -
|
269 |
| - - name: Get version tag from package.json |
270 |
| - id: get_version |
271 |
| - # only run this on "push" to "master" or alpha releases |
272 |
| - if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }} |
273 |
| - run: | |
274 |
| - version=$(node -p "require('./package.json').version") |
275 |
| - echo "VERSION_TAG=$version" >> "$GITHUB_OUTPUT" |
| 323 | + sparse-checkout-cone-mode: false |
| 324 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }} |
276 | 325 |
|
277 | 326 | - name: Download release metadata
|
278 | 327 | # only run this on "push" to "master" or alpha releases
|
|
0 commit comments