Skip to content

Commit

Permalink
优化发布
Browse files Browse the repository at this point in the history
  • Loading branch information
youlingdada committed Oct 17, 2024
1 parent eb53ed0 commit d5b4b4b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/jobs/build_and_upload_linux.yaml
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
14 changes: 1 addition & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends musl-tools
- name: Install openssl
run: sudo apt-get install pkg-config libssl-dev

- name: set env
run: |
echo "OPENSSL_INCLUDE_DIR=/usr/include/openssl" >> $GITHUB_ENV
echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
echo "X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR=/usr/include/openssl" >> $GITHUB_ENV
echo "X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
- name: print include
run: ls /usr/include/openssl

- uses: actions/checkout@v4
- name: Build release binary
run: cargo build --release --target x86_64-unknown-linux-musl
Expand All @@ -109,7 +98,6 @@ jobs:
asset_name: nvm-linux.tar.gz
asset_content_type: application/octet-stream


build_and_upload_windows:
runs-on: windows-latest
needs: create_release # 确保在创建发布之后再运行
Expand Down

0 comments on commit d5b4b4b

Please sign in to comment.