-
Notifications
You must be signed in to change notification settings - Fork 13
71 lines (62 loc) · 1.91 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Go Release
on:
push:
# 触发条件:当推送到 master 分支或创建新标签时运行
# branches:
# - master
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install MinGW-w64
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x # 使用所需的 Go 版本
cache: true
- name: Install Bee tool
run: | # 安装 Bee 工具
go install github.com/beego/bee/v2@latest
# - name: Build for multiple platforms
# env:
# GOOS: linux darwin windows # 指定目标操作系统
# GOARCH: amd64 arm64 # 指定目标架构
# run: |
# for os in $GOOS; do
# for arch in $GOARCH; do
# output_name="myapp_${os}_${arch}"
# echo "Building for $os/$arch..."
# GOOS=$os GOARCH=$arch bee pack -o $output_name -be GOOS=$os GOARCH=$arch
# done
# done
- name: Build and package for Linux
run: |
export GOOS=linux
export GOARCH=amd64
bee pack -a linux_amd64_feature -be GOOS=$GOOS GOARCH=$GOARCH
- name: Build and package for Windows
run: |
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export CGO_ENABLED=1
export GOOS=windows
export GOARCH=amd64
bee pack -a windows_amd64_feature -be GOOS=$GOOS GOARCH=$GOARCH
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
prerelease: false
files: |
linux_amd64_feature.tar.gz
windows_amd64_feature.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PERSONAL_ACCESS_TOKEN }}