name: "Release"
on:
push:
branches:
- main
- test
tags:
- v*
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
os: windows-2025
cargo: cargo
binext: .exe - target: x86_64-unknown-linux-musl
os: ubuntu-latest
cargo: cargo
binext: ""
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cargo: cross
binext: ""
- target: x86_64-apple-darwin
os: macos-latest
cargo: cargo
binext: ""
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
profile: minimal
- name: Install cross
run: |
cargo install cross --git https://github.com/cross-rs/cross.git
if: matrix.cargo == 'cross'
- name: Build and strip
shell: bash run: |
mkdir bin
${{ matrix.cargo }} build --features bin-build --bin zhconv --release --target ${{ matrix.target }}
mv target/${{ matrix.target }}/release/zhconv${{ matrix.binext }} "bin/zhconv-${{ matrix.target }}${{ matrix.binext }}"
${{ matrix.cargo }} build --features bin-build --features opencc --bin zhconv --release --target ${{ matrix.target }}
mv target/${{ matrix.target }}/release/zhconv${{ matrix.binext }} "bin/zhconv-opencc-${{ matrix.target }}${{ matrix.binext }}"
strip -v "$f" || echo "strip failed"
# if [ "${{ matrix.os }}" = "windows-2025" ]; then
# 7z a "$staging.zip" "$staging"
# else
# tar czf "$staging.tar.gz" "$staging"
# fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.target }}
path: bin/
release:
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
pattern: binaries-*
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
*