6
6
push :
7
7
branches :
8
8
- main
9
- workflow_dispatch :
10
9
11
10
env :
12
11
CARGO_TERM_COLOR : always
@@ -30,44 +29,29 @@ jobs:
30
29
with :
31
30
pull_token : ${{ secrets.PULL_TOKEN }}
32
31
33
- # If it's a nightly release, tag with the release time. If the tag is `main`,
34
- # we want to use the version from the `Cargo.toml` file.
35
32
- name : Compute release name and tag
36
33
id : release_info
37
34
run : |
38
- if [[ $IS_NIGHTLY ]]; then
39
- echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
40
- echo "release_name=Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT
41
- elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
42
- # Parse the version from the `Cargo.toml` file.
43
- VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "sp1-build") | .version')
44
-
45
- echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
46
- echo "release_name=v${VERSION}" >> $GITHUB_OUTPUT
47
- else
48
- echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
49
- echo "release_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
50
- fi
51
-
52
- # Creates a tag for this release.
53
- - name : Create build-specific tag
54
- uses : actions/github-script@v7
55
- env :
56
- TAG_NAME : ${{ steps.release_info.outputs.tag_name }}
57
- with :
58
- script : |
59
- const createTag = require('./.github/scripts/create-tag.js')
60
- await createTag({ github, context }, process.env.TAG_NAME)
35
+ # Parse the version from the `Cargo.toml` file.
36
+ VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "sp1-build") | .version')
37
+ echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
38
+ echo "release_name=v${VERSION}" >> $GITHUB_OUTPUT
61
39
62
40
- name : Build changelog
63
41
id : build_changelog
64
42
uses : mikepenz/release-changelog-builder-action@v4
65
43
with :
66
- fromTag : ${{ env.IS_NIGHTLY && 'nightly' || '' }}
67
44
toTag : ${{ steps.release_info.outputs.tag_name }}
68
45
env :
69
46
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
70
47
48
+ - name : Create release
49
+ id : create_release
50
+ env :
51
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52
+ run : |
53
+ gh release create ${{ steps.release_info.outputs.tag_name }} --target main --latest --notes ${{ steps.build_changelog.outputs.changelog }}
54
+
71
55
release :
72
56
name : ${{ matrix.target }} (${{ matrix.runner }})
73
57
runs-on : ${{ matrix.runner }}
@@ -109,24 +93,11 @@ jobs:
109
93
steps :
110
94
- uses : actions/checkout@v4
111
95
112
- - name : Install rust toolchain
113
- id : rustc-toolchain
114
- uses : actions-rs/toolchain@v1
115
- with :
116
- toolchain : stable
117
- profile : minimal
118
- override : true
119
- targets : ${{ matrix.target }}
120
-
121
- - uses : Swatinem/rust-cache@v2
122
- with :
123
- key : ${{ matrix.target }}
124
- cache-on-failure : true
125
-
126
- - name : Install go
127
- uses : actions/setup-go@v5
96
+ # Install rust and go.
97
+ - name : Setup CI
98
+ uses : ./.github/actions/setup
128
99
with :
129
- go-version : " ^1.22.1 "
100
+ pull_token : ${{ secrets.PULL_TOKEN }}
130
101
131
102
- name : Check go installation
132
103
run : |
@@ -199,7 +170,7 @@ jobs:
199
170
ARCH : ${{ matrix.arch }}
200
171
# NOTE: SP1UP Relies on the version name being the tag name,
201
172
# DO NOT CHANGE THIS WITHOUT UPDATING SP1UP TOO.
202
- VERSION_NAME : ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
173
+ VERSION_NAME : ${{ needs.prepare.outputs.tag_name }}
203
174
shell : bash
204
175
run : |
205
176
if [ "$PLATFORM_NAME" == "linux" ]; then
@@ -217,33 +188,14 @@ jobs:
217
188
echo "file_name=cargo_prove_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT
218
189
fi
219
190
220
- # Creates the release for this specific version
221
- # Note: If this CI job runs again on the same tag,
222
- # it will override the files there, but not change the commit to the current main.
223
- - name : Create release
224
- uses : softprops/action-gh-release@v2
225
- with :
226
- name : ${{ needs.prepare.outputs.release_name }}
227
- tag_name : ${{ needs.prepare.outputs.tag_name }}
228
- prerelease : ${{ env.IS_NIGHTLY }}
229
- body : ${{ needs.prepare.outputs.changelog }}
230
- files : |
231
- ${{ steps.artifacts.outputs.file_name }}
232
- ${{ steps.man.outputs.cargo_prove_man }}
233
-
234
- # If this is a nightly release, it also updates the release
235
- # tagged `nightly` for compatibility with `sp1up`
236
- - name : Update nightly release
237
- if : ${{ env.IS_NIGHTLY }}
238
- uses : softprops/action-gh-release@v2
239
- with :
240
- name : " Nightly"
241
- tag_name : " nightly"
242
- prerelease : true
243
- body : ${{ needs.prepare.outputs.changelog }}
244
- files : |
245
- ${{ steps.artifacts.outputs.file_name }}
246
- ${{ steps.man.outputs.cargo_prove_man }}
191
+ # Upload the artifacts to the release.
192
+ - name : Upload Release artifact
193
+ id : upload_release_artifact
194
+ env :
195
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
196
+ run : |
197
+ gh release upload ${{ needs.prepare.outputs.tag_name }} ${{ steps.artifacts.outputs.file_name }}
198
+
247
199
248
200
toolchain-test :
249
201
name : " Test toolchain installation (${{ matrix.name }})"
@@ -316,39 +268,16 @@ jobs:
316
268
AWS_SG_ID : " ${{ secrets.AWS_SG_ID }}"
317
269
GH_PAT : ${{ secrets.GH_PAT }}
318
270
319
- cleanup :
320
- name : Release cleanup
321
- runs-on : ubuntu-latest
322
- timeout-minutes : 30
323
- needs : release
324
- if : always()
325
- steps :
326
- - uses : actions/checkout@v4
327
-
328
- # Moves the `nightly` tag to `HEAD`
329
- - name : Move nightly tag
330
- if : ${{ env.IS_NIGHTLY }}
331
- uses : actions/github-script@v7
332
- with :
333
- script : |
334
- const moveTag = require('./.github/scripts/move-tag.js')
335
- await moveTag({ github, context }, 'nightly')
336
-
337
- - name : Delete old nightlies
338
- uses : actions/github-script@v7
339
- with :
340
- script : |
341
- const prunePrereleases = require('./.github/scripts/prune-prereleases.js')
342
- await prunePrereleases({github, context})
343
-
344
271
# If any of the jobs fail, this will create a high-priority issue to signal so.
345
272
issue :
346
273
name : Open an issue
347
274
runs-on : ubuntu-latest
348
- needs : [prepare, release, cleanup ]
275
+ needs : [prepare, release]
349
276
if : failure()
350
277
steps :
351
278
- uses : actions/checkout@v4
279
+
280
+ # todo remove this and use GH cli to create the issue
352
281
- uses : JasonEtco/create-an-issue@v2
353
282
env :
354
283
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -357,3 +286,7 @@ jobs:
357
286
with :
358
287
update_existing : true
359
288
filename : .github/RELEASE_FAILURE_ISSUE_TEMPLATE.md
289
+
290
+ - name : Delete failed release
291
+ run : |
292
+ gh release delete ${{ needs.prepare.outputs.tag_name }} --cleanup-tag
0 commit comments