forked from babyname/fate
-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (118 loc) · 4.51 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
UPLOAD_BIN_FILE: true
jobs:
build:
name: Build
strategy:
matrix:
go-version: [1.13.x]
platform: [ windows-latest, ubuntu-latest, macos-latest]
arch: [386, amd64]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
#GOARCH: ${{ matrix.arch }}
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build ${{ matrix.platform }} ${{ matrix.arch }}
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
id: build_linux
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
${GOROOT}/bin/go mod tidy
export GOARCH=${{ matrix.arch }}
echo "::set-env name=FATENAME::fate_$(go env GOOS)_$(go env GOARCH)"
echo "$(go env GOOS) $(go env GOARCH)"
echo "buiding"
${GOROOT}/bin/go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console
echo "compress"
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH)
- name: Build ${{ matrix.platform }} ${{ matrix.arch }}
if: matrix.platform == 'windows-latest' && matrix.arch == 'amd64'
id: build_windows_amd64
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
go mod tidy
set GOARCH=${{ matrix.arch }}
echo "::set-env name=FATENAME::fate_windows_amd64"
echo "buiding"
go build -o fate_windows_amd64.exe -v ./cmd/console
echo "compress"
Compress-Archive -Path fate_windows_amd64.exe -DestinationPath fate_windows_amd64.zip
- name: Build ${{ matrix.platform }} ${{ matrix.arch }}
if: matrix.platform == 'windows-latest' && matrix.arch == '386'
id: build_windows_386
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
go mod tidy
set GOARCH=${{ matrix.arch }}
echo "::set-env name=FATENAME::fate_windows_386"
echo "buiding"
go build -o fate_windows_386.exe -v ./cmd/console
echo "compress"
Compress-Archive -Path fate_windows_386.exe -DestinationPath fate_windows_386.zip
- name: Upload Linux
uses: actions/upload-artifact@master
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
name: ${{ env.FATENAME }}.tar.gz
path: ${{ env.FATENAME }}.tar.gz
- name: Upload Windows
uses: actions/upload-artifact@master
if: matrix.platform == 'windows-latest' && env.UPLOAD_BIN_FILE
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
name: ${{ env.FATENAME }}.zip
path: ${{ env.FATENAME }}.zip
- name: Create Release
id: create_release_windows
if: matrix.platform == 'windows-latest' && env.UPLOAD_BIN_FILE
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
artifacts: "${{ env.FATENAME }}.zip"
allowUpdates: true
commit: master
tag: auto_build
body: |
this is only a latest build from master
version: https://github.com/godcong/fate/commit/${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
- name: Create Release
id: create_release_linux
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
artifacts: "${{ env.FATENAME }}.tar.gz"
allowUpdates: true
commit: master
tag: auto_build
body: |
this is only a latest build from master
version: https://github.com/godcong/fate/commit/${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false