Skip to content

chore(ci): use gh release and rm unused nightly logic #2182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/docker-publish-gnark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: Docker Publish Gnark

on:
push:
tags:
- "v*.*.*"
release:
types: [published]
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
name: Docker Publish CLI

on:
push:
tags:
- "v*.*.*"
release:
types: [published]
schedule:
- cron: "0 0 * * *"
# Trigger without any parameters a proactive rebuild
Expand Down
168 changes: 67 additions & 101 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,32 @@ jobs:
with:
pull_token: ${{ secrets.PULL_TOKEN }}

# If it's a nightly release, tag with the release time. If the tag is `main`,
# we want to use the version from the `Cargo.toml` file.
- name: Compute release name and tag
id: release_info
run: |
if [[ $IS_NIGHTLY ]]; then
echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
echo "release_name=Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
# Parse the version from the `Cargo.toml` file.
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "sp1-build") | .version')

echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
echo "release_name=v${VERSION}" >> $GITHUB_OUTPUT
else
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "release_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
fi
# Parse the version from the `Cargo.toml` file.
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "sp1-build") | .version')
echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
echo "release_name=v${VERSION}" >> $GITHUB_OUTPUT

# - name: Build changelog
# uses: mikepenz/release-changelog-builder-action@v4
# id: build_changelog
# with:
# outputFile: ${{ steps.release_info.outputs.tag_name }}-changelog.md
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Creates a tag for this release.
- name: Create build-specific tag
uses: actions/github-script@v7
- name: Create release
id: create_release
env:
TAG_NAME: ${{ steps.release_info.outputs.tag_name }}
with:
script: |
const createTag = require('./.github/scripts/create-tag.js')
await createTag({ github, context }, process.env.TAG_NAME)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag name should only be the version were making

GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GH_DEBUG=api gh release create ${{ steps.release_info.outputs.tag_name }} --target main --generate-notes --latest=false

- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
fromTag: ${{ env.IS_NIGHTLY && 'nightly' || '' }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks for the last release by default

toTag: ${{ steps.release_info.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print GH version
run: |
gh version

release:
name: ${{ matrix.target }} (${{ matrix.runner }})
Expand Down Expand Up @@ -109,25 +98,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install rust toolchain
id: rustc-toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
# Install rust and go
- name: Install rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup install stable

- name: Install go
uses: actions/setup-go@v5
with:
go-version: "^1.22.1"

- name: Check go installation
run: |
go version
Expand Down Expand Up @@ -199,7 +180,7 @@ jobs:
ARCH: ${{ matrix.arch }}
# NOTE: SP1UP Relies on the version name being the tag name,
# DO NOT CHANGE THIS WITHOUT UPDATING SP1UP TOO.
VERSION_NAME: ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
VERSION_NAME: ${{ needs.prepare.outputs.tag_name }}
shell: bash
run: |
if [ "$PLATFORM_NAME" == "linux" ]; then
Expand All @@ -217,33 +198,28 @@ jobs:
echo "file_name=cargo_prove_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT
fi

# Creates the release for this specific version
# Note: If this CI job runs again on the same tag,
# it will override the files there, but not change the commit to the current main.
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.prepare.outputs.release_name }}
tag_name: ${{ needs.prepare.outputs.tag_name }}
prerelease: ${{ env.IS_NIGHTLY }}
body: ${{ needs.prepare.outputs.changelog }}
files: |
${{ steps.artifacts.outputs.file_name }}
${{ steps.man.outputs.cargo_prove_man }}

# If this is a nightly release, it also updates the release
# tagged `nightly` for compatibility with `sp1up`
- name: Update nightly release
if: ${{ env.IS_NIGHTLY }}
uses: softprops/action-gh-release@v2
with:
name: "Nightly"
tag_name: "nightly"
prerelease: true
body: ${{ needs.prepare.outputs.changelog }}
files: |
${{ steps.artifacts.outputs.file_name }}
${{ steps.man.outputs.cargo_prove_man }}
# Upload the artifacts to the release.
- name: Upload Release artifact
id: upload_release_artifact
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.prepare.outputs.tag_name }} ${{ steps.artifacts.outputs.file_name }}

set-latest-release:
name: Set latest release
runs-on: ubuntu-latest
needs: [release, prepare]
if: success()
steps:
- uses: actions/checkout@v4

- name: Set latest release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Wait until all the binaries have been built to set the latest release.
gh release edit ${{ needs.prepare.outputs.tag_name }} --latest

toolchain-test:
name: "Test toolchain installation (${{ matrix.name }})"
Expand Down Expand Up @@ -271,8 +247,6 @@ jobs:
uses: "actions/checkout@v4"

- name: "Install SP1"
env:
SP1UP_VERSION: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
run: |
cd sp1up
chmod +x sp1up
Expand Down Expand Up @@ -316,39 +290,16 @@ jobs:
AWS_SG_ID: "${{ secrets.AWS_SG_ID }}"
GH_PAT: ${{ secrets.GH_PAT }}

cleanup:
name: Release cleanup
runs-on: ubuntu-latest
timeout-minutes: 30
needs: release
if: always()
steps:
- uses: actions/checkout@v4

# Moves the `nightly` tag to `HEAD`
- name: Move nightly tag
if: ${{ env.IS_NIGHTLY }}
uses: actions/github-script@v7
with:
script: |
const moveTag = require('./.github/scripts/move-tag.js')
await moveTag({ github, context }, 'nightly')

- name: Delete old nightlies
uses: actions/github-script@v7
with:
script: |
const prunePrereleases = require('./.github/scripts/prune-prereleases.js')
await prunePrereleases({github, context})

# If any of the jobs fail, this will create a high-priority issue to signal so.
issue:
name: Open an issue
runs-on: ubuntu-latest
needs: [prepare, release, cleanup]
needs: [prepare, release]
if: failure()
steps:
- uses: actions/checkout@v4

# todo remove this and use GH cli to create the issue
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -357,3 +308,18 @@ jobs:
with:
update_existing: true
filename: .github/RELEASE_FAILURE_ISSUE_TEMPLATE.md

# If any of the jobs fail, this will create a high-priority issue to signal so.
delete-failed-release:
name: Delete failed release
runs-on: ubuntu-latest
needs: [prepare, release]
if: failure()
steps:
- uses: actions/checkout@v4

- name: Delete failed release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete ${{ needs.prepare.outputs.tag_name }} --cleanup-tag
5 changes: 0 additions & 5 deletions .github/workflows/toolchain-ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ jobs:
sudo apt-get install -y build-essential pkg-config libssl-dev git

- name: "Install SP1"
env:
# Releases occur on pushes to `main` and tags. If pushing to a tag, the SP1UP_VERSION is
# the tag name. If pushing to `main`, the SP1UP_VERSION is `latest`.
# TODO: Once we change the release workflow on `main` to push to tag `main`, we can remove this.
SP1UP_VERSION: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
run: |
cd sp1up
chmod +x sp1up
Expand Down
Loading