forked from gogf/gf-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 1.91 KB
/
go.yml
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
72
73
74
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Build and Release
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Build gf to build all
run: |
echo "Building linux amd64 binary..."
GOOS=linux GOARCH=amd64 go build -o gf
chmod +x gf
# gf build
- name: gf build
run: |
./gf build
# 处理gf-cli批量编译后的文件结构
- name: moving files before upx
run: |
cd bin
for OS in *;do for FILE in $OS/*;\
do if [[ ${OS} =~ 'windows' ]];\
then rm -rf noupx && mkdir noupx && mv $FILE noupx/gf_$OS.exe && rm -rf $OS;\
else mv $FILE gf_$OS && rm -rf $OS;\
fi;done;done
# UPX 加壳所有文件
- name: upx all binary
uses: gacts/upx@master
with:
dir: './bin'
upx_args: '-9'
# 移动未UPX的windows程序到上传bin目录下
- name: moving files after upx
run: |
cd bin
mv noupx/* ./ && rm -rf noupx
ls -l
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./bin/gf_*"]'