Files
Fig/.woodpecker.yml

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
- git clone --depth=1 https://github.com/xmake-io/xmake.git /tmp/xmake
- cd /tmp/xmake && make install PREFIX=/usr/local
- xmake --version
# 构建项目
- 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
- git clone --depth=1 https://github.com/xmake-io/xmake.git /tmp/xmake
- cd /tmp/xmake && make install PREFIX=/usr/local
- xmake --version
# 构建项目
- 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