gitlink-cli/.devops/wyx_gitlink_cli_release.yml

42 lines
2.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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.

version: 2
name: wyx_gitlink_cli_release
description: "部署流水线:打 tag 时交叉编译 Linux/Windows/macOS 三平台二进制并发布 GitLink Release"
trigger:
webhook: gitlink@1.0.0
event:
- ref: push
ruleset-operator: AND
global:
concurrent: 1
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone含 tag 历史)
task: git_clone@1.2.9
input:
remote_url: '"https://gitlink.org.cn/jiangtx/gitlink-cli.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: ssh_cmd_0
name: 交叉编译并发布 Release
task: ssh_cmd@1.1.1
input:
ssh_ip: '"121.41.212.97"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_pass: ((gitlink_cli.wyx_ssh_pass))
ssh_cmd: >-
"cd /root && rm -rf release && mkdir release && cd release && git clone https://gitlink.org.cn/jiangtx/gitlink-cli.git && cd gitlink-cli && git fetch --tags && export PATH=$PATH:/usr/local/go/bin && export GOPROXY=https://goproxy.cn,direct && VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo dev) && echo '>>> 发布版本: '$VERSION && echo '>>> 1. 编译 Linux amd64' && GOOS=linux GOARCH=amd64 go build -o gitlink-cli-linux-amd64 . && echo '>>> 2. 编译 Windows amd64' && GOOS=windows GOARCH=amd64 go build -o gitlink-cli-windows-amd64.exe . && echo '>>> 3. 编译 macOS arm64' && GOOS=darwin GOARCH=arm64 go build -o gitlink-cli-darwin-arm64 . && echo '>>> 4. 发布 GitLink Release用服务器已登录的 gitlink-cli' && gitlink-cli release +create --owner jiangtx --repo gitlink-cli --tag $VERSION --name $VERSION --target master --body '本次发布版本 $VERSION含 Linux/Windows/macOS 三平台二进制。新增 pm/wiki/export/alias/browse/status 等模块,详见变更说明。' && echo '✅ Release '$VERSION' 发布完成'"
needs:
- git_clone_0
- ref: end
name: 结束
task: end
needs:
- ssh_cmd_0