-
Notifications
You must be signed in to change notification settings - Fork 54
fix: Improve release #322
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
fix: Improve release #322
Conversation
WalkthroughThe pull request modifies the GitHub Actions workflow configuration for the release process. Key changes include the addition of a new step for capturing tagging and publishing outputs, the update of the changelog generation tool, and the introduction of a new step to create a GitHub release. The workflow now uses Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
.github/workflows/release.yaml (2)
48-50
: Configure standard-version with a configuration fileUsing command-line flags makes the configuration harder to maintain and version control. Consider moving the configuration to a
.versionrc.json
file.Create a
.versionrc.json
file:{ "tagPrefix": "v", "skip": { "bump": true, "commit": true, "tag": true }, "types": [ {"type": "feat", "section": "Features"}, {"type": "fix", "section": "Bug Fixes"}, {"type": "chore", "section": "Maintenance"}, {"type": "docs", "section": "Documentation"}, {"type": "style", "section": "Styling"}, {"type": "refactor", "section": "Refactors"}, {"type": "perf", "section": "Performance"}, {"type": "test", "section": "Tests"} ] }Then modify the step:
- npx standard-version --tag-prefix v --commit-all + npx standard-version
Line range hint
1-69
: Consider adding error handling and conditional stepsThe workflow could benefit from some reliability improvements:
- Add condition checks between critical steps
- Include error handling for npm publish failures
- Add cleanup steps for failed runs
Consider these modifications:
- Add conditions to prevent subsequent steps from running if a critical step fails:
- name: Build packages id: build run: pnpm run build - name: Tag and Publish Packages if: success() && steps.build.outcome == 'success' id: tag_publish ... - name: Generate Changelog if: success() && steps.tag_publish.outcome == 'success' ...
- Add a cleanup step:
- name: Cleanup on failure if: failure() run: | git tag -d ${{ steps.tag_publish.outputs.TAG }} || true git reset --hard HEAD~1 || true
- name: Create GitHub Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag_publish.outputs.TAG }} | ||
release_name: Release ${{ steps.tag_publish.outputs.TAG }} | ||
body_path: CHANGELOG.md | ||
draft: false | ||
prerelease: ${{ contains(github.event.inputs.release_type, 'pre') }} |
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.
Replace deprecated action and improve release content
The actions/create-release@v1
action is deprecated. Additionally, using the entire CHANGELOG.md file might include historical entries irrelevant to this release.
Replace with the newer softprops/action-gh-release
action:
- name: Create GitHub Release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: ${{ steps.tag_publish.outputs.TAG }}
- release_name: Release ${{ steps.tag_publish.outputs.TAG }}
- body_path: CHANGELOG.md
- draft: false
- prerelease: ${{ contains(github.event.inputs.release_type, 'pre') }}
+ name: Create GitHub Release
+ uses: softprops/action-gh-release@v1
+ with:
+ tag_name: ${{ steps.tag_publish.outputs.TAG }}
+ name: Release ${{ steps.tag_publish.outputs.TAG }}
+ body: |
+ # Release Notes
+ $(cat CHANGELOG.md | sed -n "/^## \[${{ steps.tag_publish.outputs.TAG }}/,/^## \[/p" | sed '$d')
+ draft: false
+ prerelease: ${{ contains(github.event.inputs.release_type, 'pre') }}
+ token: ${{ secrets.GITHUB_TOKEN }}
This change:
- Uses a maintained action
- Extracts only the relevant section from CHANGELOG.md
- Adds a better formatted release body
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag_publish.outputs.TAG }} | |
release_name: Release ${{ steps.tag_publish.outputs.TAG }} | |
body_path: CHANGELOG.md | |
draft: false | |
prerelease: ${{ contains(github.event.inputs.release_type, 'pre') }} | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.tag_publish.outputs.TAG }} | |
name: Release ${{ steps.tag_publish.outputs.TAG }} | |
body: | | |
# Release Notes | |
$(cat CHANGELOG.md | sed -n "/^## \[${{ steps.tag_publish.outputs.TAG }}/,/^## \[/p" | sed '$d') | |
draft: false | |
prerelease: ${{ contains(github.event.inputs.release_type, 'pre') }} | |
token: ${{ secrets.GITHUB_TOKEN }} |
id: tag_publish | ||
run: | | ||
npx lerna version ${{ github.event.inputs.release_type }} --conventional-commits --yes --no-private --force-publish | ||
npx lerna publish from-git --yes --dist-tag ${{ github.event.inputs.release_type == 'preminor' && 'next' || 'latest' }} | ||
|
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.
💡 Codebase verification
Keep --force-publish
flag and add explicit output capture
The --force-publish
flag is necessary due to the extensive interdependencies between packages. The packages form a complex dependency graph where:
sdk
depends oncore
,create-burner
, andtorii-client
react
depends onstate
,torii-client
, andutils
state
depends ontorii-client
- Multiple packages depend on
torii-client
Only add the output capture modification:
id: tag_publish
run: |
+ echo "TAG=$(npx lerna version ${{ github.event.inputs.release_type }} --conventional-commits --yes --no-private --force-publish | tail -n 1)" >> $GITHUB_OUTPUT
- npx lerna version ${{ github.event.inputs.release_type }} --conventional-commits --yes --no-private --force-publish
npx lerna publish from-git --yes --dist-tag ${{ github.event.inputs.release_type == 'preminor' && 'next' || 'latest' }}
🔗 Analysis chain
Add explicit output capture for the tag version
The step ID tag_publish
suggests this step should output the tag version, but there's no explicit output capture. This could cause the subsequent GitHub Release step to fail.
Apply this modification:
id: tag_publish
run: |
+ echo "TAG=$(npx lerna version ${{ github.event.inputs.release_type }} --conventional-commits --yes --no-private --force-publish | tail -n 1)" >> $GITHUB_OUTPUT
- npx lerna version ${{ github.event.inputs.release_type }} --conventional-commits --yes --no-private --force-publish
npx lerna publish from-git --yes --dist-tag ${{ github.event.inputs.release_type == 'preminor' && 'next' || 'latest' }}
Also, consider removing the --force-publish
flag unless absolutely necessary, as it bypasses version checks and could lead to unintended publications.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if force-publish is really needed by looking for dependencies between packages
rg -l "workspace:.*" packages/*/package.json
Length of output: 510
Script:
#!/bin/bash
# Let's check the actual workspace dependencies in these packages
for file in packages/torii-client/package.json packages/state/package.json packages/sdk/package.json packages/create-burner/package.json packages/react/package.json packages/core/package.json; do
echo "=== $file ==="
cat "$file" | jq '.dependencies,.devDependencies' | grep -A1 "workspace:"
done
Length of output: 2793
Summary by CodeRabbit
New Features
Improvements