-
Notifications
You must be signed in to change notification settings - Fork 90
chore: add new rust release flow #1959
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ed37ded
chore: add new rust release flow
ananas-block fb5c349
chore: remove emojis, sync versions with crates io
ananas-block aa2cc79
update scripts
ananas-block a7ff06d
move light-zero-copy-derive tests to light-zero-copy
ananas-block 0eb8140
update script
ananas-block e01f4a1
update pr validation
ananas-block 15b679c
delete legacy workflows and scripts
ananas-block cd92e02
update pr script
ananas-block 21195e5
refactor: zero copy derive tests
ananas-block 2b38c86
fix batched-merkle-tree-tests
ananas-block e5bd9df
bump light program profiler
ananas-block 8763917
update: version
ananas-block 09c29f2
ignore failing trybuild tests
ananas-block 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 was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: Release PR Validation | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| validate-release: | ||
| # Only run on release PRs | ||
| if: contains(github.event.pull_request.labels.*.name, 'release') | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Rust | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - name: Install cargo-release | ||
| run: cargo install cargo-release | ||
|
|
||
| - name: Validate packages for publishing | ||
| run: ./scripts/validate-packages.sh |
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 |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| name: Publish Release | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| publish-release: | ||
| # Only run on merged release PRs | ||
| if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Rust | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - name: Install cargo-release | ||
| run: cargo install cargo-release | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Validate packages before publishing | ||
| env: | ||
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| echo "=========================================" | ||
| echo "Phase 1: Validation (dry-run)" | ||
| echo "=========================================" | ||
| ./scripts/validate-packages.sh "$BASE_SHA" "$HEAD_SHA" | ||
|
|
||
| - name: Publish packages to crates.io | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| echo "" | ||
| echo "=========================================" | ||
| echo "Phase 2: Publishing (atomic)" | ||
| echo "=========================================" | ||
| ./scripts/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA" | ||
|
|
||
| - name: Create GitHub releases | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| echo "" | ||
| echo "=========================================" | ||
| echo "Phase 3: Creating GitHub releases" | ||
| echo "=========================================" | ||
|
|
||
| # Detect packages that were published | ||
| PACKAGES_STRING=$(./scripts/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA") | ||
| read -ra PACKAGES <<< "$PACKAGES_STRING" | ||
|
|
||
| for pkg in "${PACKAGES[@]}"; do | ||
| echo "----------------------------------------" | ||
| # Get the version from Cargo.toml | ||
| VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"$pkg\") | .version") | ||
| TAG="${pkg}-v${VERSION}" | ||
|
|
||
| echo "Creating GitHub release for $TAG..." | ||
| if gh release create "$TAG" --generate-notes --title "$TAG"; then | ||
| echo "✓ Created release for $TAG" | ||
| else | ||
| echo "Warning: Failed to create release for $TAG" | ||
| fi | ||
| done | ||
|
|
||
| echo "" | ||
| echo "✓ GitHub releases created" | ||
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
Oops, something went wrong.
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.
Grant
issues: writeso the PR comment succeeds.The final
github-scriptstep posts a PR comment. With onlycontents: write, GitHub returns 403 and the workflow fails to report success. Please add the required scope.runs-on: ubuntu-latest permissions: - contents: write + contents: write + issues: write🤖 Prompt for AI Agents