Skip to content

Commit 8ce615a

Browse files
authored
Merge pull request #196 from vdice/ci/fix-canary
ci(release.yml): only recreate canary once all artifacts are ready to upload
2 parents 8765246 + 2de4bda commit 8ce615a

File tree

1 file changed

+45
-46
lines changed

1 file changed

+45
-46
lines changed

.github/workflows/release.yaml

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,9 @@ env:
1313
CARGO_TERM_COLOR: always
1414

1515
jobs:
16-
reset_canary_release:
17-
name: Delete and create Canary Release
18-
runs-on: ubuntu-latest
19-
steps:
20-
21-
- name: Delete canary tag
22-
uses: dev-drprasad/[email protected]
23-
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
with:
26-
tag_name: canary
27-
28-
- name: Recreate canary tag and release
29-
uses: ncipollo/[email protected]
30-
with:
31-
tag: canary
32-
allowUpdates: true
33-
prerelease: true
34-
body: |
35-
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
36-
It is only intended for developers wishing to try out the latest features in Spin-js-sdk, some of which may not be fully implemented.
37-
3816
build:
3917
name: Build spinjs
4018
runs-on: ${{ matrix.config.os }}
41-
needs: reset_canary_release
4219
strategy:
4320
fail-fast: false
4421
matrix:
@@ -189,7 +166,7 @@ jobs:
189166
- name: Upload build artifact
190167
uses: actions/upload-artifact@v3
191168
with:
192-
name: js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
169+
name: js2wasm
193170
path: _dist/js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
194171

195172
- name: upload binary to Github release
@@ -200,19 +177,11 @@ jobs:
200177
file: _dist/js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
201178
tag: ${{ github.ref }}
202179

203-
- name: upload binary to Github release (canary)
204-
uses: svenstaro/upload-release-action@v2
205-
with:
206-
repo_token: ${{ secrets.GITHUB_TOKEN }}
207-
file: _dist/js2wasm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
208-
tag: "canary"
209-
210180
checksums_and_manifests:
211181
name: generate checksums
212182
runs-on: ubuntu-latest
213183
needs: build
214184
steps:
215-
216185
- uses: actions/checkout@v3
217186
- name: set the release version (main)
218187
shell: bash
@@ -225,11 +194,18 @@ jobs:
225194

226195
- name: download release assets
227196
uses: actions/download-artifact@v3
197+
with:
198+
name: js2wasm
228199

229200
- name: generate checksums
230201
run: |
231202
ls -lh
232-
sha256sum js2wasm*.tar.gz/js2wasm*.tar.gz > checksums-${{ env.RELEASE_VERSION }}.txt
203+
sha256sum js2wasm*.tar.gz > checksums-${{ env.RELEASE_VERSION }}.txt
204+
205+
- uses: actions/upload-artifact@v3
206+
with:
207+
name: js2wasm
208+
path: checksums-${{ env.RELEASE_VERSION }}.txt
233209

234210
- name: upload checksums to Github release
235211
if: startsWith(github.ref, 'refs/tags/v')
@@ -239,27 +215,50 @@ jobs:
239215
file: checksums-${{ env.RELEASE_VERSION }}.txt
240216
tag: ${{ github.ref }}
241217

242-
- name: upload checksums to Github release (canary)
243-
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
244-
uses: svenstaro/upload-release-action@v2
245-
with:
246-
repo_token: ${{ secrets.GITHUB_TOKEN }}
247-
file: checksums-${{ env.RELEASE_VERSION }}.txt
248-
tag: "canary"
249-
250218
- name: create plugin manifest
251219
shell: bash
252220
run: bash .plugin-manifests/generate-manifest.sh ${{ env.RELEASE_VERSION }} checksums-${{ env.RELEASE_VERSION }}.txt > js2wasm.json
253221

254-
- name: upload plugin manifest to releases
222+
- uses: actions/upload-artifact@v3
223+
with:
224+
name: js2wasm
225+
path: js2wasm.json
226+
227+
- name: upload plugin manifest to release
228+
if: startsWith(github.ref, 'refs/tags/v')
255229
uses: svenstaro/upload-release-action@v2
256230
with:
257231
repo_token: ${{ secrets.GITHUB_TOKEN }}
258232
file: js2wasm.json
259-
tag: ${{ env.RELEASE_VERSION }}
233+
tag: ${{ github.ref }}
260234

261-
235+
reset_canary_release:
236+
name: Delete and create Canary Release
237+
runs-on: ubuntu-latest
238+
needs: checksums_and_manifests
239+
if: github.ref == 'refs/heads/main'
240+
steps:
241+
- name: download release assets
242+
uses: actions/download-artifact@v3
243+
with:
244+
name: js2wasm
262245

263-
246+
- name: Delete canary tag
247+
uses: dev-drprasad/[email protected]
248+
env:
249+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250+
with:
251+
tag_name: canary
252+
delete_release: true
264253

265-
254+
- name: Recreate canary tag and release
255+
uses: ncipollo/[email protected]
256+
with:
257+
tag: canary
258+
allowUpdates: true
259+
prerelease: true
260+
artifacts: "js2wasm*.tar.gz,js2wasm.json,checksums-canary.txt"
261+
commit: ${{ github.sha }}
262+
body: |
263+
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
264+
It is only intended for developers wishing to try out the latest features in spin-js-sdk, some of which may not be fully implemented.

0 commit comments

Comments
 (0)