Files
Fig-TreeWalker/.woodpecker.yml
PuqiAR e14c86744f
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
谁会CI帮我下我要死了 3
2026-01-03 11:55:23 +08:00

65 lines
2.5 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

steps:
- name: build-cross
image: "ubuntu:24.04"
shell: /bin/bash # 强制 bash避免 dash 解析错误
when:
event:
- push
- tag
commands:
# 1⃣ 国内源加速
- cp /etc/apt/sources.list /etc/apt/sources.list.backup
- |
cat <<EOF > /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs) main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse
EOF
- apt-get update -y
- apt-get install -y curl git build-essential clang llvm mingw-w64 ninja-build jq
# 2⃣ 下载并安装 xmake 到全局 PATH稳定
- curl -fsSL https://xmake.io/shget.text -o /tmp/xmake-get.sh
- chmod +x /tmp/xmake-get.sh
- bash /tmp/xmake-get.sh --install-to=/usr/local/bin
# 3⃣ 获取真实版本号
- VERSION=$(git describe --tags --always --dirty)
# 4⃣ Linux 构建
- xmake f -m release
- xmake -v
- mkdir -p dist
- cp `xmake u -o`/Fig dist/Fig-${VERSION}-linux-x86_64
# 5⃣ Windows cross-build
- xmake f -m release --plat=windows --arch=x86_64 --cc=x86_64-w64-mingw32-g++ --cxx=x86_64-w64-mingw32-g++
- xmake -v
- cp `xmake u -o`/Fig.exe dist/Fig-${VERSION}-windows-x86_64.exe
- name: gitea-release
image: "ubuntu:24.04"
shell: /bin/bash
when:
event:
- tag
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
commands:
- TAG=$(git describe --tags --exact-match 2>/dev/null || echo ${DRONE_TAG})
- echo "Uploading Fig binaries for tag $TAG to Gitea"
# Linux binary
- |
curl -X POST -H "Authorization: token ${GITEA_TOKEN}" \
-F "name=Fig-${TAG}-linux-x86_64" -F "file=@dist/Fig-${TAG}-linux-x86_64" \
"https://git.fig-lang.cn/api/v1/repos/PuqiAR/Fig/releases/${TAG}/assets"
# Windows binary
- |
curl -X POST -H "Authorization: token ${GITEA_TOKEN}" \
-F "name=Fig-${TAG}-windows-x86_64.exe" -F "file=@dist/Fig-${TAG}-windows-x86_64.exe" \
"https://git.fig-lang.cn/api/v1/repos/PuqiAR/Fig/releases/${TAG}/assets"