fix release #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} (${{ matrix.arch }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Linux builds | |
- os: ubuntu-latest | |
arch: x64 | |
artifact_name: rime-deploy-linux-x64 | |
cc: gcc | |
- os: ubuntu-latest | |
arch: arm64 | |
artifact_name: rime-deploy-linux-arm64 | |
cc: aarch64-linux-gnu-gcc | |
- os: ubuntu-latest | |
arch: arm | |
artifact_name: rime-deploy-linux-arm | |
cc: arm-linux-gnueabihf-gcc | |
# macOS builds | |
- os: macos-latest | |
arch: x64 | |
artifact_name: rime-deploy-macos-x64 | |
cc: clang | |
- os: macos-latest | |
arch: arm64 | |
artifact_name: rime-deploy-macos-arm64 | |
cc: clang | |
# Windows builds | |
- os: windows-latest | |
arch: x64 | |
artifact_name: rime-deploy-windows-x64.exe | |
cc: gcc | |
steps: | |
- uses: actions/checkout@v4 | |
# 只在 Linux 上设置 QEMU 和交叉编译器 | |
- name: Install QEMU and cross-compilers (Linux) | |
if: runner.os == 'Linux' && (matrix.arch == 'arm64' || matrix.arch == 'arm') | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
if [ "${{ matrix.arch }}" = "arm64" ]; then | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
elif [ "${{ matrix.arch }}" = "arm" ]; then | |
sudo apt-get install -y gcc-arm-linux-gnueabihf | |
fi | |
# 跨平台创建目录 | |
- name: Create directories (Windows) | |
if: runner.os == 'Windows' | |
shell: cmd | |
run: | | |
if not exist "build" md build | |
if not exist "artifacts" md artifacts | |
- name: Create directories (Unix) | |
if: runner.os != 'Windows' | |
shell: bash | |
run: | | |
mkdir -p build artifacts | |
- name: Build | |
shell: bash | |
env: | |
CC: ${{ matrix.cc }} | |
run: | | |
make CC=${{ matrix.cc }} | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
cp rime-deploy.exe artifacts/${{ matrix.artifact_name }} | |
else | |
cp rime-deploy artifacts/${{ matrix.artifact_name }} | |
chmod +x artifacts/${{ matrix.artifact_name }} | |
fi | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rime-deploy-${{ matrix.os }}-${{ matrix.arch }} | |
path: artifacts/* |