-
Notifications
You must be signed in to change notification settings - Fork 496
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
+71
−112
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
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' || '' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }}) | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 }})" | ||
|
@@ -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 | ||
|
@@ -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 }} | ||
|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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