-
Notifications
You must be signed in to change notification settings - Fork 9
feat: 添加发布工作流和更新 Cargo.toml 配置以支持二进制包格式 #30
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,97 @@ | ||||||||||||
| name: Release | ||||||||||||
|
|
||||||||||||
| on: | ||||||||||||
| workflow_run: | ||||||||||||
| workflows: ["Quality Check"] | ||||||||||||
| branches: [main] | ||||||||||||
| types: [completed] | ||||||||||||
| workflow_dispatch: | ||||||||||||
|
|
||||||||||||
| permissions: | ||||||||||||
| contents: write | ||||||||||||
| pull-requests: write | ||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| release-plz: | ||||||||||||
| if: ${{ github.repository_owner == 'drivercraft' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }} | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
| steps: | ||||||||||||
| - name: Checkout code | ||||||||||||
| uses: actions/checkout@v4 | ||||||||||||
|
|
||||||||||||
| - name: Release with release-plz | ||||||||||||
| uses: release-plz/action@v0.5 | ||||||||||||
| with: | ||||||||||||
| command: release | ||||||||||||
| env: | ||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||||||||||||
|
|
||||||||||||
| build-binaries: | ||||||||||||
| needs: release-plz | ||||||||||||
| if: ${{ needs.release-plz.result == 'success' }} | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
| steps: | ||||||||||||
| - name: Checkout code | ||||||||||||
| uses: actions/checkout@v4 | ||||||||||||
|
||||||||||||
| uses: actions/checkout@v4 | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 |
Copilot
AI
Jan 29, 2026
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.
The workflow only builds for x86_64-unknown-linux-gnu target, but cargo-binstall users may need binaries for other common platforms like macOS (aarch64-apple-darwin, x86_64-apple-darwin) and Windows (x86_64-pc-windows-msvc). Consider adding a matrix strategy to build for multiple platforms to improve the utility of the binstall integration.
Copilot
AI
Jan 29, 2026
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.
The version extraction uses 'grep -m1' which will match the first occurrence of 'version' in the file. This could incorrectly match a version string in a comment or different section. Consider using a more specific pattern like 'grep -m1 '^version =' ostool/Cargo.toml' to ensure it only matches the package version field.
| version=$(grep -m1 '^version' ostool/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/') | |
| version=$(grep -m1 '^version =' ostool/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/') |
Copilot
AI
Jan 29, 2026
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.
The build and packaging steps only execute if the release already exists (exists == 'true'), which seems counterintuitive. If the release doesn't exist, no binaries will be built or uploaded. This logic appears reversed - binaries should be built when the release exists to upload to it, but the workflow won't create binaries for new releases. Consider reviewing this conditional logic to ensure it matches the intended behavior.
Copilot
AI
Jan 29, 2026
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.
The shell script doesn't have error handling enabled. If any command in the multi-line script fails (e.g., cargo build fails), the subsequent commands will still execute. Consider adding 'set -e' at the beginning of the script to exit on any error, or check the exit status of the cargo build commands before proceeding.
Copilot
AI
Jan 29, 2026
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.
The shell script lacks error handling. If mkdir or cp commands fail, or if the tar command fails, the subsequent sha256sum command will still execute. Consider adding 'set -e' at the beginning to ensure the script exits on any error.
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.
The repository owner check 'drivercraft' does not match the repository URL in ostool/Cargo.toml which points to 'github.com/ZR233/ostool'. This inconsistency will prevent the workflow from running when triggered. Either update this check to match 'ZR233' or update the repository field in Cargo.toml to match 'drivercraft'.