Skip to content

Commit ee58add

Browse files
authored
chore(ci): use gh release and rm unused nightly logic (#2182)
1 parent 8c627ea commit ee58add

File tree

4 files changed

+71
-112
lines changed

4 files changed

+71
-112
lines changed

.github/workflows/docker-publish-gnark.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
name: Docker Publish Gnark
33

44
on:
5-
push:
6-
tags:
7-
- "v*.*.*"
5+
release:
6+
types: [published]
87
schedule:
98
- cron: "0 0 * * *"
109
workflow_dispatch:

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
name: Docker Publish CLI
44

55
on:
6-
push:
7-
tags:
8-
- "v*.*.*"
6+
release:
7+
types: [published]
98
schedule:
109
- cron: "0 0 * * *"
1110
# Trigger without any parameters a proactive rebuild

.github/workflows/release.yml

Lines changed: 67 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,32 @@ jobs:
3030
with:
3131
pull_token: ${{ secrets.PULL_TOKEN }}
3232

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.
3533
- name: Compute release name and tag
3634
id: release_info
3735
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
36+
# Parse the version from the `Cargo.toml` file.
37+
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "sp1-build") | .version')
38+
echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
39+
echo "release_name=v${VERSION}" >> $GITHUB_OUTPUT
40+
41+
# - name: Build changelog
42+
# uses: mikepenz/release-changelog-builder-action@v4
43+
# id: build_changelog
44+
# with:
45+
# outputFile: ${{ steps.release_info.outputs.tag_name }}-changelog.md
46+
# env:
47+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5148

52-
# Creates a tag for this release.
53-
- name: Create build-specific tag
54-
uses: actions/github-script@v7
49+
- name: Create release
50+
id: create_release
5551
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)
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
GH_DEBUG=api gh release create ${{ steps.release_info.outputs.tag_name }} --target main --generate-notes --latest=false
6155
62-
- name: Build changelog
63-
id: build_changelog
64-
uses: mikepenz/release-changelog-builder-action@v4
65-
with:
66-
fromTag: ${{ env.IS_NIGHTLY && 'nightly' || '' }}
67-
toTag: ${{ steps.release_info.outputs.tag_name }}
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Print GH version
57+
run: |
58+
gh version
7059
7160
release:
7261
name: ${{ matrix.target }} (${{ matrix.runner }})
@@ -109,25 +98,17 @@ jobs:
10998
steps:
11099
- uses: actions/checkout@v4
111100

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
101+
# Install rust and go
102+
- name: Install rust
103+
run: |
104+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
105+
rustup install stable
125106
126107
- name: Install go
127108
uses: actions/setup-go@v5
128109
with:
129110
go-version: "^1.22.1"
130-
111+
131112
- name: Check go installation
132113
run: |
133114
go version
@@ -199,7 +180,7 @@ jobs:
199180
ARCH: ${{ matrix.arch }}
200181
# NOTE: SP1UP Relies on the version name being the tag name,
201182
# DO NOT CHANGE THIS WITHOUT UPDATING SP1UP TOO.
202-
VERSION_NAME: ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
183+
VERSION_NAME: ${{ needs.prepare.outputs.tag_name }}
203184
shell: bash
204185
run: |
205186
if [ "$PLATFORM_NAME" == "linux" ]; then
@@ -217,33 +198,28 @@ jobs:
217198
echo "file_name=cargo_prove_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT
218199
fi
219200
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 }}
201+
# Upload the artifacts to the release.
202+
- name: Upload Release artifact
203+
id: upload_release_artifact
204+
env:
205+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206+
run: |
207+
gh release upload ${{ needs.prepare.outputs.tag_name }} ${{ steps.artifacts.outputs.file_name }}
208+
209+
set-latest-release:
210+
name: Set latest release
211+
runs-on: ubuntu-latest
212+
needs: [release, prepare]
213+
if: success()
214+
steps:
215+
- uses: actions/checkout@v4
216+
217+
- name: Set latest release
218+
env:
219+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220+
run: |
221+
# Wait until all the binaries have been built to set the latest release.
222+
gh release edit ${{ needs.prepare.outputs.tag_name }} --latest
247223
248224
toolchain-test:
249225
name: "Test toolchain installation (${{ matrix.name }})"
@@ -271,8 +247,6 @@ jobs:
271247
uses: "actions/checkout@v4"
272248

273249
- name: "Install SP1"
274-
env:
275-
SP1UP_VERSION: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
276250
run: |
277251
cd sp1up
278252
chmod +x sp1up
@@ -316,39 +290,16 @@ jobs:
316290
AWS_SG_ID: "${{ secrets.AWS_SG_ID }}"
317291
GH_PAT: ${{ secrets.GH_PAT }}
318292

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-
344293
# If any of the jobs fail, this will create a high-priority issue to signal so.
345294
issue:
346295
name: Open an issue
347296
runs-on: ubuntu-latest
348-
needs: [prepare, release, cleanup]
297+
needs: [prepare, release]
349298
if: failure()
350299
steps:
351300
- uses: actions/checkout@v4
301+
302+
# todo remove this and use GH cli to create the issue
352303
- uses: JasonEtco/create-an-issue@v2
353304
env:
354305
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -357,3 +308,18 @@ jobs:
357308
with:
358309
update_existing: true
359310
filename: .github/RELEASE_FAILURE_ISSUE_TEMPLATE.md
311+
312+
# If any of the jobs fail, this will create a high-priority issue to signal so.
313+
delete-failed-release:
314+
name: Delete failed release
315+
runs-on: ubuntu-latest
316+
needs: [prepare, release]
317+
if: failure()
318+
steps:
319+
- uses: actions/checkout@v4
320+
321+
- name: Delete failed release
322+
env:
323+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
324+
run: |
325+
gh release delete ${{ needs.prepare.outputs.tag_name }} --cleanup-tag

.github/workflows/toolchain-ec2.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ jobs:
9595
sudo apt-get install -y build-essential pkg-config libssl-dev git
9696
9797
- name: "Install SP1"
98-
env:
99-
# Releases occur on pushes to `main` and tags. If pushing to a tag, the SP1UP_VERSION is
100-
# the tag name. If pushing to `main`, the SP1UP_VERSION is `latest`.
101-
# TODO: Once we change the release workflow on `main` to push to tag `main`, we can remove this.
102-
SP1UP_VERSION: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
10398
run: |
10499
cd sp1up
105100
chmod +x sp1up

0 commit comments

Comments
 (0)