-
Notifications
You must be signed in to change notification settings - Fork 8
Release/v3.0.10 #13
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
Release/v3.0.10 #13
Changes from all commits
c2f6f48
d95d2b2
30129ad
b048552
3efe6fc
2b809dd
c6e7643
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| echo "Reading Cargo.toml" | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Step 1: Read the version from Cargo.toml | ||||||||||||||||||||||||||||
| version=$(grep '^version = ' Cargo.toml | head -n 1 | sed 's/version = "\(.*\)"/\1/') | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if [ -z "$version" ]; then | ||||||||||||||||||||||||||||
| echo "Version not found in Cargo.toml" | ||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+13
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. 🧹 Nitpick | 🔵 Trivial Version extraction should validate workspace.package section. Line 8 extracts the version using a simple grep pattern that matches any line starting with -version=$(grep '^version = ' Cargo.toml | head -n 1 | sed 's/version = "\(.*\)"/\1/')
+# Extract version from [workspace.package] section
+version=$(awk '/^\[workspace.package\]/,/^\[/ {if (/^version = /) print}' Cargo.toml | sed 's/version = "\(.*\)"/\1/')📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| echo "Aligning for version: $version" | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # GNU/BSD compat | ||||||||||||||||||||||||||||
| sedi=(-i'') | ||||||||||||||||||||||||||||
| case "$(uname)" in | ||||||||||||||||||||||||||||
| # For macOS, use two parameters | ||||||||||||||||||||||||||||
| Darwin*) sedi=(-i '') | ||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| echo "Updating ..." | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Update the version for all crates in the Cargo.toml workspace.dependencies section | ||||||||||||||||||||||||||||
| sed "${sedi[@]}" -e '/\[workspace.dependencies\]/,/# Magicblock/s/version = ".*"/version = "='$version'"/' Cargo.toml | ||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+27
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. Fix sed variable quoting and add error handling for substitution. Line 27 has two issues:
Apply this diff to fix escaping and add validation: -sed "${sedi[@]}" -e '/\[workspace.dependencies\]/,/# Magicblock/s/version = ".*"/version = "='$version'"/' Cargo.toml
+sed "${sedi[@]}" -e '/\[workspace.dependencies\]/,/# Magicblock/s/version = ".*"/version = "='"${version}"'"/' Cargo.toml || {
+ echo "Error: Failed to update workspace.dependencies in Cargo.toml"
+ exit 1
+}Additionally, consider making the sed range pattern more robust (e.g., using a stricter pattern or validating that the file structure matches expectations before attempting substitution). 🧰 Tools🪛 Shellcheck (0.11.0)[info] 27-27: Double quote to prevent globbing and word splitting. (SC2086) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Potential for collisions in Cargo.lock, use cargo update to update it | ||||||||||||||||||||||||||||
| cargo update --workspace --manifest-path ./Cargo.toml | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Check if any changes have been made to the specified files, if running with --check | ||||||||||||||||||||||||||||
| if [[ "$1" == "--check" ]]; then | ||||||||||||||||||||||||||||
| files_to_check=( | ||||||||||||||||||||||||||||
| "Cargo.toml" | ||||||||||||||||||||||||||||
| "programs/gpl_session/Cargo.toml" | ||||||||||||||||||||||||||||
| "programs/gpl_session/macros/Cargo.toml" | ||||||||||||||||||||||||||||
| "programs/gpl_session/macros/attribute/Cargo.toml" | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| for file in "${files_to_check[@]}"; do | ||||||||||||||||||||||||||||
| # Check if the file has changed from the previous commit | ||||||||||||||||||||||||||||
| if git diff --name-only | grep -q "$file"; then | ||||||||||||||||||||||||||||
| echo "Error: version not aligned for $file. Align the version, commit and try again." | ||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
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.
License mismatch between workspace and member crates.
The workspace declares
license = "MIT"(line 14), but all member crates declarelicense = "GPL-3.0-or-later". This inconsistency will likely cause licensing metadata and publishing issues. Align the workspace license to match the member crates, or clarify if different license profiles are intentional.🤖 Prompt for AI Agents