v1.0.2 #4
Workflow file for this run
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: Release | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
name: Build Release 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 | |
asset_name: rime-deploy-linux-x64 | |
cc: gcc | |
- os: ubuntu-latest | |
arch: arm64 | |
artifact_name: rime-deploy-linux-arm64 | |
asset_name: rime-deploy-linux-arm64 | |
cc: aarch64-linux-gnu-gcc | |
- os: ubuntu-latest | |
arch: arm | |
artifact_name: rime-deploy-linux-arm | |
asset_name: rime-deploy-linux-arm | |
cc: arm-linux-gnueabihf-gcc | |
# macOS builds (native only) | |
- os: macos-latest | |
arch: x64 | |
artifact_name: rime-deploy-macos-x64 | |
asset_name: rime-deploy-macos-x64 | |
cc: clang | |
- os: macos-latest | |
arch: arm64 | |
artifact_name: rime-deploy-macos-arm64 | |
asset_name: rime-deploy-macos-arm64 | |
cc: clang | |
# Windows builds (native only) | |
- os: windows-latest | |
arch: x64 | |
artifact_name: rime-deploy-windows-x64.exe | |
asset_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: Build | |
shell: cmd | |
if: runner.os == 'Windows' | |
env: | |
CC: ${{ matrix.cc }} | |
run: | | |
md build 2>nul || ver>nul | |
md artifacts 2>nul || ver>nul | |
make | |
copy rime-deploy.exe artifacts\${{ matrix.artifact_name }} | |
cd artifacts | |
7z a -tzip ${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }} | |
- name: Build (Unix) | |
shell: bash | |
if: runner.os != 'Windows' | |
env: | |
CC: ${{ matrix.cc }} | |
run: | | |
mkdir -p build artifacts | |
make | |
cp rime-deploy artifacts/${{ matrix.artifact_name }} | |
chmod +x artifacts/${{ matrix.artifact_name }} | |
cd artifacts | |
tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }} | |
# 上传构建产物到 release | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
artifacts/${{ matrix.asset_name }}.* | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
# 创建更新日志 | |
changelog: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate Changelog | |
id: changelog | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update Release Notes | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body_path: CHANGELOG.md | |
# 跨平台创建目录 | |
- 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 |