更新自动构建
This commit is contained in:
67
.github/workflows/build.yml
vendored
Normal file
67
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
name: build
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
build:
|
||||
name: build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
build: [linux, macos, windows]
|
||||
include:
|
||||
- build: linux
|
||||
os: ubuntu-18.04
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-musl
|
||||
archive-name: ncmmiao-linux.tar.gz
|
||||
- build: macos
|
||||
os: macos-latest
|
||||
rust: stable
|
||||
target: x86_64-apple-darwin
|
||||
archive-name: ncmmiao-macos.tar.gz
|
||||
- build: windows
|
||||
os: windows-2019
|
||||
rust: stable-x86_64-msvc
|
||||
target: x86_64-pc-windows-msvc
|
||||
archive-name: ncmmiao-windows.7z
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: Build binary
|
||||
run: cargo build --verbose --release --target ${{ matrix.target }}
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
- name: Strip binary (linux and macos)
|
||||
if: matrix.build == 'linux' || matrix.build == 'macos'
|
||||
run: strip "target/${{ matrix.target }}/release/ncmmiao"
|
||||
|
||||
- name: Build archive
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir archive
|
||||
cp LICENSE README.md archive/
|
||||
cd archive
|
||||
if [ "${{ matrix.build }}" = "windows" ]; then
|
||||
cp "../target/${{ matrix.target }}/release/ncmmiao.exe" ./
|
||||
7z a "${{ matrix.archive-name }}" LICENSE README.md ncmmiao.exe
|
||||
else
|
||||
cp "../target/${{ matrix.target }}/release/ncmmiao" ./
|
||||
tar -czf "${{ matrix.archive-name }}" LICENSE README.md ncmmiao
|
||||
fi
|
||||
- name: Upload archive
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ matrix.archive-name }}
|
||||
path: archive/${{ matrix.archive-name }}
|
||||
Reference in New Issue
Block a user