-
Notifications
You must be signed in to change notification settings - Fork 1
Add binary releases for cargo-binstall support #33
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
Draft
Copilot
wants to merge
3
commits into
main
Choose a base branch
from
copilot/fix-29
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: Release Binaries | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| build-and-upload: | ||
| name: Build and upload binaries | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| target: x86_64-unknown-linux-gnu | ||
| suffix: "" | ||
| - os: ubuntu-latest | ||
| target: x86_64-unknown-linux-musl | ||
| suffix: "" | ||
| - os: ubuntu-latest | ||
| target: aarch64-unknown-linux-gnu | ||
| suffix: "" | ||
| - os: windows-latest | ||
| target: x86_64-pc-windows-msvc | ||
| suffix: .exe | ||
| - os: macos-latest | ||
| target: x86_64-apple-darwin | ||
| suffix: "" | ||
| - os: macos-latest | ||
| target: aarch64-apple-darwin | ||
| suffix: "" | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
|
|
||
| - name: Install cross-compilation tools | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc-aarch64-linux-gnu | ||
|
|
||
| - name: Install musl tools | ||
| if: matrix.target == 'x86_64-unknown-linux-musl' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y musl-tools | ||
|
|
||
| - name: Configure cross-compilation | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc' >> $GITHUB_ENV | ||
|
|
||
| - name: Build binaries | ||
| run: cargo build --release --target ${{ matrix.target }} | ||
|
|
||
| - name: Create archive directory | ||
| run: mkdir -p artifacts | ||
|
|
||
| - name: Prepare binaries (Unix) | ||
| if: matrix.os != 'windows-latest' | ||
| run: | | ||
| cp target/${{ matrix.target }}/release/spongebob${{ matrix.suffix }} artifacts/ | ||
| cp target/${{ matrix.target }}/release/goodboye${{ matrix.suffix }} artifacts/ | ||
|
|
||
| - name: Prepare binaries (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: | | ||
| copy target\${{ matrix.target }}\release\spongebob${{ matrix.suffix }} artifacts\ | ||
| copy target\${{ matrix.target }}\release\goodboye${{ matrix.suffix }} artifacts\ | ||
|
|
||
| - name: Create tar.gz archive (Unix) | ||
| if: matrix.os != 'windows-latest' | ||
| run: | | ||
| cd artifacts | ||
| tar -czf ../spongebob-${{ github.ref_name }}-${{ matrix.target }}.tar.gz * | ||
|
|
||
| - name: Create zip archive (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: | | ||
| cd artifacts | ||
| 7z a ../spongebob-${{ github.ref_name }}-${{ matrix.target }}.zip * | ||
|
|
||
| - name: Upload tar.gz to release (Unix) | ||
| if: matrix.os != 'windows-latest' | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: ./spongebob-${{ github.ref_name }}-${{ matrix.target }}.tar.gz | ||
|
|
||
| - name: Upload zip to release (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: ./spongebob-${{ github.ref_name }}-${{ matrix.target }}.zip | ||
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
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.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 7 months ago
The best way to fix this is to explicitly declare a minimal
permissionsblock at the job level forbuild-and-uploadin.github/workflows/release-binaries.yaml. Since this job only uploads binaries to releases, the smallest necessary permission iscontents: write(needed bysoftprops/action-gh-releaseto upload release assets). If future jobs only need to read the repository,contents: readwould suffice for those, but for this job,contents: writeis required.To implement this, add a
permissions:section underbuild-and-uploadat the same indentation level asname:(line 12). No new methods, imports, or special definitions are needed—just an update to the YAML structure.