-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb53ed0
commit d5b4b4b
Showing
2 changed files
with
41 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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,40 @@ | ||
name: build_and_upload_linux | ||
|
||
on: | ||
workflow_call: {} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: create_release # 确保在创建发布之后再运行 | ||
|
||
steps: | ||
- uses: hecrj/setup-rust-action@v1 | ||
with: | ||
rust-version: ${{env.RUST_VERSION}} | ||
targets: x86_64-unknown-linux-musl | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
key: static-linux-binary | ||
- name: Install musl tools | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y --no-install-recommends musl-tools | ||
- uses: actions/checkout@v4 | ||
- name: Build release binary | ||
run: cargo build --release --target x86_64-unknown-linux-musl | ||
- name: Strip binary from debug symbols | ||
run: strip target/x86_64-unknown-linux-musl/release/nvm | ||
- name: Package | ||
run: tar -czf nvm-linux.tar.gz -C target/x86_64-unknown-linux-musl/release nvm -C ../../.. install/linux/ # 修改路径,确保正确打包 | ||
|
||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create_release.outputs.upload_url }} | ||
asset_path: nvm-linux.tar.gz | ||
asset_name: nvm-linux.tar.gz | ||
asset_content_type: application/octet-stream |
This file contains 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