Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
205 lines (187 loc) · 6.07 KB
/
Copy pathTaskfile.yml
File metadata and controls
205 lines (187 loc) · 6.07 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
version: '3'
set: [pipefail]
vars:
VERSION:
sh: git describe --tags
SHA1SUM:
sh: command -v sha1sum >/dev/null 2>&1 && printf sha1sum || printf 'shasum -a 1'
UPX:
sh: command -v upx >/dev/null 2>&1 && printf upx || true
tasks:
release:
desc: Build all release archives and their SHA-1 manifest
preconditions:
- sh: command -v sha1sum >/dev/null 2>&1 || command -v shasum >/dev/null 2>&1
msg: Install sha1sum or shasum to build release archives.
cmds:
- task: release:clean
- task: release:standard
- task: release:darwin-amd64
- task: release:arm
- task: release:linux-arm64
- task: release:darwin-arm64
- task: release:mips
- task: release:mips64
- task: release:checksums
publish:
desc: Push the release branch and tag, then publish assets on GitHub
vars:
BRANCH:
sh: git branch --show-current
preconditions:
- sh: test -n "{{.BRANCH}}"
msg: Check out the release branch before publishing.
- sh: test "{{.VERSION}}" = "$(git describe --tags --exact-match 2>/dev/null)"
msg: Check out the release tag before publishing.
- sh: test -z "$(git status --porcelain)"
msg: Commit or remove all changes before publishing.
- sh: command -v gh >/dev/null 2>&1
msg: Install the GitHub CLI before publishing.
- sh: gh auth status >/dev/null 2>&1
msg: Authenticate with the GitHub CLI before publishing.
- sh: test -s bin/SHA1SUMS && test "$(find bin -maxdepth 1 -type f -name 'v2ray-plugin-*-{{.VERSION}}.tar.gz' | wc -l | tr -d '[:space:]')" -eq 12
msg: Build all release archives with 'task release' before publishing.
cmds:
- git push origin "{{.BRANCH}}"
- git push origin "refs/tags/{{.VERSION}}"
- gh release create "{{.VERSION}}" bin/v2ray-plugin-*-{{.VERSION}}.tar.gz bin/SHA1SUMS --title "{{.VERSION}}" --generate-notes --verify-tag
release:clean:
internal: true
cmds:
- rm -rf bin
- mkdir -p bin
release:standard:
internal: true
cmds:
- for:
matrix:
OS: [linux, windows, freebsd]
ARCH: [amd64, '386']
task: release:archive-single
vars:
GOOS: '{{.ITEM.OS}}'
GOARCH: '{{.ITEM.ARCH}}'
SKIP_UPX: '{{or (eq .ITEM.OS "freebsd") (eq .ITEM.OS "windows")}}'
release:darwin-amd64:
internal: true
cmds:
- task: release:archive-single
vars:
GOOS: darwin
GOARCH: amd64
SKIP_UPX: 'true'
release:archive-single:
internal: true
vars:
BINARY: 'v2ray-plugin_{{.GOOS}}_{{.GOARCH}}{{if eq .GOOS "windows"}}.exe{{end}}'
ARCHIVE: 'bin/v2ray-plugin-{{.GOOS}}-{{.GOARCH}}-{{.VERSION}}.tar.gz'
cmds:
- task: release:compile
vars:
GOOS: '{{.GOOS}}'
GOARCH: '{{.GOARCH}}'
BINARY: '{{.BINARY}}'
- task: release:compress
vars:
BINARY: '{{.BINARY}}'
SKIP_UPX: '{{.SKIP_UPX}}'
- tar -zcf "{{.ARCHIVE}}" "{{.BINARY}}"
release:compile:
internal: true
cmds:
- >-
env CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -v
-ldflags "-X main.VERSION={{.VERSION}} -s -w -buildid="
-o "{{.BINARY}}"
release:compress:
internal: true
if: '{{and (ne .UPX "") (eq .SKIP_UPX "false")}}'
cmds:
- '{{.UPX}} -9 "{{.BINARY}}" > /dev/null'
release:arm:
internal: true
cmds:
- for: ['5', '6', '7']
task: release:compile-arm
vars:
GOARM: '{{.ITEM}}'
BINARY: 'v2ray-plugin_linux_arm{{.ITEM}}'
- for: [v2ray-plugin_linux_arm5, v2ray-plugin_linux_arm6, v2ray-plugin_linux_arm7]
task: release:compress
vars:
BINARY: '{{.ITEM}}'
SKIP_UPX: 'false'
- >-
tar -zcf "bin/v2ray-plugin-linux-arm-{{.VERSION}}.tar.gz"
v2ray-plugin_linux_arm5 v2ray-plugin_linux_arm6 v2ray-plugin_linux_arm7
release:compile-arm:
internal: true
cmds:
- >-
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM={{.GOARM}} go build -v
-ldflags "-X main.VERSION={{.VERSION}} -s -w -buildid="
-o "{{.BINARY}}"
release:linux-arm64:
internal: true
cmds:
- task: release:archive-single
vars:
GOOS: linux
GOARCH: arm64
SKIP_UPX: 'false'
release:darwin-arm64:
internal: true
cmds:
- task: release:archive-single
vars:
GOOS: darwin
GOARCH: arm64
SKIP_UPX: 'true'
release:mips:
internal: true
cmds:
- for: [mips, mipsle]
task: release:compile-mips
vars:
GOARCH: '{{.ITEM}}'
GOMIPS: ''
BINARY: 'v2ray-plugin_linux_{{.ITEM}}'
- for: [mips, mipsle]
task: release:compile-mips
vars:
GOARCH: '{{.ITEM}}'
GOMIPS: softfloat
BINARY: 'v2ray-plugin_linux_{{.ITEM}}_sf'
- for: [v2ray-plugin_linux_mips, v2ray-plugin_linux_mipsle, v2ray-plugin_linux_mips_sf, v2ray-plugin_linux_mipsle_sf]
task: release:compress
vars:
BINARY: '{{.ITEM}}'
SKIP_UPX: 'false'
- >-
tar -zcf "bin/v2ray-plugin-linux-mips-{{.VERSION}}.tar.gz"
v2ray-plugin_linux_mips v2ray-plugin_linux_mipsle
v2ray-plugin_linux_mips_sf v2ray-plugin_linux_mipsle_sf
release:compile-mips:
internal: true
cmds:
- >-
env CGO_ENABLED=0 GOOS=linux GOARCH={{.GOARCH}}
{{if .GOMIPS}}GOMIPS={{.GOMIPS}}{{end}} go build -v
-ldflags "-X main.VERSION={{.VERSION}} -s -w -buildid="
-o "{{.BINARY}}"
release:mips64:
internal: true
cmds:
- for: [mips64, mips64le]
task: release:compile
vars:
GOOS: linux
GOARCH: '{{.ITEM}}'
BINARY: 'v2ray-plugin_linux_{{.ITEM}}'
- >-
tar -zcf "bin/v2ray-plugin-linux-mips64-{{.VERSION}}.tar.gz"
v2ray-plugin_linux_mips64 v2ray-plugin_linux_mips64le
release:checksums:
internal: true
cmds:
- '{{.SHA1SUM}} bin/v2ray-plugin-*.tar.gz | tee bin/SHA1SUMS'