104 lines
3.1 KiB
YAML
104 lines
3.1 KiB
YAML
name: Release Build
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: '版本号 (如: 1.0.0)'
|
|
required: true
|
|
|
|
env:
|
|
VERSION: ${{ github.event.inputs.version || github.ref_name }}
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- platform: linux
|
|
arch: x86_64
|
|
runner: ubuntu-latest
|
|
- platform: linux
|
|
arch: aarch64
|
|
runner: ubuntu-22.04-arm
|
|
- platform: windows
|
|
arch: x86_64
|
|
runner: windows-latest
|
|
- platform: macos
|
|
arch: x86_64
|
|
runner: macos-12
|
|
- platform: macos
|
|
arch: arm64
|
|
runner: macos-14
|
|
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install xmake
|
|
run: |
|
|
curl -fsSL https://xmake.io/shget.text | bash
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Configure
|
|
run: |
|
|
if [ "${{ matrix.platform }}" = "windows" ]; then
|
|
xmake f -p mingw -a ${{ matrix.arch }} -m release
|
|
else
|
|
xmake f -p ${{ matrix.platform }} -a ${{ matrix.arch }} -m release
|
|
fi
|
|
|
|
- name: Build
|
|
run: xmake -j4
|
|
|
|
- name: Create Package
|
|
run: |
|
|
mkdir -p Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
|
|
# 复制可执行文件
|
|
if [ "${{ matrix.platform }}" = "windows" ]; then
|
|
cp build/mingw/${{ matrix.arch }}/release/Fig.exe Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
|
|
else
|
|
cp build/${{ matrix.platform }}/${{ matrix.arch }}/release/Fig Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
|
|
fi
|
|
# 复制 Library 目录
|
|
cp -r src/Module/Library Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
|
|
|
|
# 创建压缩包
|
|
if [ "${{ matrix.platform }}" = "windows" ]; then
|
|
zip -r Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
|
|
else
|
|
tar -czf Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
|
|
fi
|
|
|
|
# 生成 checksum
|
|
sha256sum Fig-${{ env.VERSION }}-*.tar.gz Fig-${{ env.VERSION }}-*.zip 2>/dev/null | grep -v "No such file" > checksums.txt || true
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: binaries-${{ matrix.platform }}-${{ matrix.arch }}
|
|
path: |
|
|
Fig-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.*
|
|
checksums.txt
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v3
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
**/*.tar.gz
|
|
**/*.zip
|
|
**/checksums.txt
|
|
generate_release_notes: true |