forked from PuqiAR/Fig-TreeWalker
78 lines
2.4 KiB
YAML
78 lines
2.4 KiB
YAML
steps:
|
|
|
|
# -------------------------------
|
|
# Linux Build
|
|
# -------------------------------
|
|
- name: build-linux
|
|
image: ubuntu:24.04
|
|
shell: /bin/sh
|
|
commands:
|
|
# 安装基础依赖
|
|
- apt-get update -y
|
|
- apt-get install -y git build-essential curl
|
|
|
|
# 安装 xmake 官方方式
|
|
- curl -fsSL https://xmake.io/shget.text | bash -s -- --prefix=/usr/local
|
|
- export PATH=$PATH:/usr/local/bin
|
|
- xmake --version
|
|
|
|
# 构建 Fig
|
|
- cd /woodpecker/src
|
|
- xmake f -p linux -a x86_64 -m release -y
|
|
- xmake build -y
|
|
|
|
# 获取版本号
|
|
- VERSION=$(grep -R "__FCORE_VERSION" src/Core/core.hpp | sed -E 's/.*"(.+)".*/\1/')
|
|
|
|
# 生成文件名
|
|
- cp build/linux/x86_64/release/Fig Fig-${VERSION}-linux-x86_64
|
|
|
|
# 上传 Gitea Release
|
|
- |
|
|
if [ -n "$GITEA_TOKEN" ]; then
|
|
curl -X POST "https://git.fig-lang.cn/api/v1/repos/PuqiAR/Fig/releases" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "tag_name=${VERSION}" \
|
|
-F "name=Fig-${VERSION}-linux-x86_64" \
|
|
-F "body=Linux x86_64 release" \
|
|
-F "assets=@Fig-${VERSION}-linux-x86_64"
|
|
fi
|
|
|
|
# -------------------------------
|
|
# Windows Build (cross compile)
|
|
# -------------------------------
|
|
- name: build-windows
|
|
image: ubuntu:24.04
|
|
shell: /bin/sh
|
|
commands:
|
|
# 安装依赖
|
|
- apt-get update -y
|
|
- apt-get install -y git build-essential curl mingw-w64
|
|
|
|
# 安装 xmake 官方方式
|
|
- curl -fsSL https://xmake.io/shget.text | bash -s -- --prefix=/usr/local
|
|
- export PATH=$PATH:/usr/local/bin
|
|
- xmake --version
|
|
|
|
# 构建 Fig Windows
|
|
- cd /woodpecker/src
|
|
- xmake f -p mingw -a x86_64 -m release -y
|
|
- xmake build -y
|
|
|
|
# 获取版本号
|
|
- VERSION=$(grep -R "__FCORE_VERSION" src/Core/core.hpp | sed -E 's/.*"(.+)".*/\1/')
|
|
|
|
# 生成文件名
|
|
- cp build/mingw/x86_64/release/Fig.exe Fig-${VERSION}-windows-x86_64.exe
|
|
|
|
# 上传 Gitea Release
|
|
- |
|
|
if [ -n "$GITEA_TOKEN" ]; then
|
|
curl -X POST "https://git.fig-lang.cn/api/v1/repos/PuqiAR/Fig/releases" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "tag_name=${VERSION}" \
|
|
-F "name=Fig-${VERSION}-windows-x86_64.exe" \
|
|
-F "body=Windows x86_64 release" \
|
|
-F "assets=@Fig-${VERSION}-windows-x86_64.exe"
|
|
fi
|