Skip to content

feat: update

feat: update #5

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
jobs:
build:
name: Build and Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, beta, nightly]
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Compile the project
run: cargo build --release
- name: Run tests
run: cargo test --verbose
# 打包二进制文件
- name: Package binary (only for release builds)
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p dist
if [ "${{ runner.os }}" = "Windows" ]; then
cp target/release/afptool-rs.exe dist/
else
cp target/release/afptool-rs dist/
fi
shell: bash
- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
with:
name: afptool-rs-${{ matrix.os }}
path: dist/