This commit is contained in:
2026-01-02 16:57:05 +08:00
parent 4dca435307
commit 6d557622b9

View File

@@ -1,52 +1,60 @@
when: # .woodpecker.yml - Fig Language CI for Woodpecker
event: # Windows/Linux 构建, xmake, 自动打包, 自动上传 Gitea Release
include: [ tag ]
steps: # 使用 Gitea token
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
GITEA_REPO: "PuqiAR/Fig" # 替换成你的 Gitea 仓库
GITEA_URL: "https://git.fig-lang.cn" # 替换成你的 Gitea 地址
setup: # Linux 构建
image: debian:stable build-linux:
commands: image: debian:bookworm
- apt-get update commands:
- apt-get install -y xmake mingw-w64 zip git - apt-get update -y
- xmake --version - apt-get install -y curl git build-essential clang llvm ninja-build jq
- curl -fsSL https://xmake.io/shget.text | bash
- export PATH=$HOME/.xmake/bin:$PATH
- xmake f -m release
- xmake -v
- mkdir -p dist
- cp `xmake u -o`/Fig dist/
# ========================= # Windows 构建
# Linux Build build-windows:
# ========================= image: mcr.microsoft.com/windows/servercore:ltsc2022
linux-build: commands:
image: debian:stable - choco install xmake -y
commands: - choco install llvm -y
- xmake f -p linux -m release - set PATH=C:\Program Files\LLVM\bin;%PATH%
- xmake - xmake f -m release --cc=clang --cxx=clang++ --ld=clang++
- mkdir -p dist/linux - xmake -v
- cp build/linux/x86_64/release/Fig dist/linux/Fig - mkdir dist
- cp -r src/Module/Library dist/linux/Library - copy `xmake u -o`\Fig dist\
- cd dist && zip -r fig-linux-${CI_COMMIT_TAG}.zip linux
# ========================= # 测试
# Windows (Mingw) Build test:
# ========================= image: debian:bookworm
windows-build: depends_on:
image: debian:stable - build-linux
commands: - build-windows
- xmake f -p mingw -m release commands:
- xmake - xmake r test_all || true
- mkdir -p dist/windows
- cp build/mingw/x86_64/release/Fig.exe dist/windows/Fig.exe
- cp -r src/Module/Library dist/windows/Library
- cd dist && zip -r fig-windows-${CI_COMMIT_TAG}.zip windows
# ========================= # Gitea Release 上传(仅在打 tag 时触发)
# Upload to Gitea Release release:
# ========================= image: debian:bookworm
release: depends_on:
image: woodpeckerci/plugin-gitea-release - build-linux
settings: - build-windows
api_key: when:
from_secret: GITEA_TOKEN event: tag
base_url: https://git.fig-lang.cn commands:
files: - TAG_NAME=${DRONE_TAG} # Woodpecker 用 DRONE_TAG 保存 tag
- dist/fig-linux-${CI_COMMIT_TAG}.zip - echo "Uploading Fig binaries for tag $TAG_NAME to Gitea"
- dist/fig-windows-${CI_COMMIT_TAG}.zip - curl -X POST -H "Authorization: token $GITEA_TOKEN" \
note: "Automated build for ${CI_COMMIT_TAG}" -F "name=Fig-linux" \
-F "label=Fig Linux binary" \
-F "file=@dist/Fig" \
"$GITEA_URL/api/v1/repos/$GITEA_REPO/releases/$TAG_NAME/assets"