Refactor: Avoid duplicate job for building release

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-05-31 13:53:03 +10:00
parent 6172bcb126
commit 187ac2d20e
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -23,26 +23,32 @@ jobs:
os: ubuntu-latest os: ubuntu-latest
output: cargo-binstall output: cargo-binstall
archive: tgz archive: tgz
use-cross: false
- target: x86_64-apple-darwin - target: x86_64-apple-darwin
os: macos-latest os: macos-latest
output: cargo-binstall output: cargo-binstall
archive: zip archive: zip
use-cross: false
- target: armv7-unknown-linux-gnueabihf - target: armv7-unknown-linux-gnueabihf
os: ubuntu-20.04 os: ubuntu-20.04
output: cargo-binstall output: cargo-binstall
archive: tgz archive: tgz
use-cross: false
- target: x86_64-pc-windows-msvc - target: x86_64-pc-windows-msvc
os: windows-latest os: windows-latest
output: cargo-binstall.exe output: cargo-binstall.exe
archive: zip archive: zip
use-cross: false
- target: x86_64-unknown-linux-musl - target: x86_64-unknown-linux-musl
os: ubuntu-latest os: ubuntu-latest
output: cargo-binstall output: cargo-binstall
archive: tgz archive: tgz
use-cross: false
- target: armv7-unknown-linux-musleabihf - target: armv7-unknown-linux-musleabihf
os: ubuntu-20.04 os: ubuntu-20.04
output: cargo-binstall output: cargo-binstall
archive: tgz archive: tgz
use-cross: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -80,19 +86,11 @@ jobs:
run: sudo apt-get install -y musl-tools run: sudo apt-get install -y musl-tools
- name: Build release - name: Build release
if: ${{ matrix.target != 'armv7-unknown-linux-musleabihf' }}
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --target ${{ matrix.target }} --release args: --target ${{ matrix.target }} --release
use-cross: ${{ matrix.use-cross }}
- name: Build release for armv7 musl target
if: ${{ matrix.target == 'armv7-unknown-linux-musleabihf' }}
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
use-cross: true
- name: Copy and rename utility - name: Copy and rename utility
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }} run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}