282 lines (256 loc) · 7.08 KB
/
release.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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
name: Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Build
strategy:
matrix:
os: [ linux, freebsd, openbsd, dragonfly, windows, darwin ]
arch: [ amd64, 386 ]
include:
- os: linux
arch: arm
arm: 5
- os: linux
arch: arm
arm: 6
- os: linux
arch: arm
arm: 7
- os: linux
arch: arm64
- os: linux
arch: mips
mips: softfloat
- os: linux
arch: mips
mips: hardfloat
- os: linux
arch: mipsle
mipsle: softfloat
- os: linux
arch: mipsle
mipsle: hardfloat
- os: linux
arch: mips64
- os: linux
arch: mips64le
- os: linux
arch: ppc64
- os: linux
arch: ppc64le
- os: linux
arch: s390x
- os: windows
arch: arm
- os: android
arch: arm64
- os: darwin
arch: arm64
- os: freebsd
arch: arm64
exclude:
- os: darwin
arch: 386
- os: dragonfly
arch: 386
fail-fast: false
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
GOARM: ${{ matrix.arm }}
GOMIPS: ${{ matrix.mips }}
GOMIPS64: ${{ matrix.mips64 }}
GOMIPSLE: ${{ matrix.mipsle }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
- name: Build fat binary
id: builder
run: |
ARGS="${GOOS}-${GOARCH}"
if [[ -n "${GOARM}" ]]; then
ARGS="${ARGS}v${GOARM}"
elif [[ -n "${GOMIPS}" ]]; then
ARGS="${ARGS}-${GOMIPS}"
elif [[ -n "${GOMIPS64}" ]]; then
ARGS="${ARGS}-${GOMIPS64}"
elif [[ -n "${GOMIPSLE}" ]]; then
ARGS="${ARGS}-${GOMIPSLE}"
fi
make ${ARGS}
echo "::set-output name=args::${ARGS}"
- name: Archive binary
run: make TARGET=${{ steps.builder.outputs.args }} releases
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: build/package/wayback*
debpkg:
name: Build DEB
strategy:
matrix:
include:
- os: linux
arch: amd64
- os: linux
arch: arm
arm: 7
- os: linux
arch: arm64
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
GOARM: ${{ matrix.arm }}
steps:
- name: Check out codebase
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Build Debian package
run: |
OS_ARCH="${GOARCH}"
PKG_ARCH="${GOARCH}"
if [[ -n "${GOARM}" ]]; then
PKG_ARCH="${PKG_ARCH}v${GOARM}"
OS_ARCH="arm32v${GOARM}"
fi
if [[ "${OS_ARCH}" == "arm64" ]]; then
OS_ARCH=arm64v8
fi
make debian DEB_IMG_ARCH=${OS_ARCH} PKG_ARCH=${PKG_ARCH}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: build/package/wayback*.deb
rpmpkg:
name: Build RPM
runs-on: ubuntu-latest
steps:
- name: Check out codebase
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build RPM package
run: make rpm
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: build/package/wayback*.rpm
aurpkg:
name: Build AUR
runs-on: ubuntu-latest
steps:
- name: Check out code base
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Build AUR package
run: |
make submodule
cd build/aur
make volume
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: |
build/aur/.SRCINFO
build/aur/PKGBUILD
build/aur/wayback*.pkg.tar.zst
if-no-files-found: error
checksum:
name: Get archived packages checksum
runs-on: ubuntu-latest
needs: [ build, debpkg, rpmpkg, aurpkg ]
outputs:
digest: ${{ steps.digest.outputs.result }}
steps:
- name: Download math result from build job
uses: actions/download-artifact@v2
with:
name: wayback
path: .
- name: Create all binary digest
id: digest
run: |
digest=$(find wayback* -type f -exec sha256sum {} +)
digest="${digest//$'%'/%25}"
digest="${digest//$'\n'/%0A}"
echo "::set-output name=result::$digest"
release:
name: Create and upload release
runs-on: ubuntu-latest
needs: [build, checksum]
steps:
- name: Check out code base
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Generate Git log
run: |
git fetch origin +refs/tags/*:refs/tags/*
echo "Current Tag: ${GITHUB_REF}"
git checkout ${GITHUB_REF} -b release-log
GITVER=$(git describe --tags)
PREVVER=$(git describe --tags --abbrev=0 ${GITVER}~1)
git log --oneline ${PREVVER}..${GITVER} > gittaglogs.txt
# Append digests
echo '
See full [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/CHANGELOG.md).
**Digests in this release:**
```
${{ needs.checksum.outputs.digest }}
```
' >> gittaglogs.txt
- name: Download math result from build and checksum jobs
uses: actions/download-artifact@v2
with:
name: wayback
path: wayback # Put files to wayback directory
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
body_path: gittaglogs.txt
files: wayback/wayback*
draft: true
dispatch:
if: github.repository == 'wabarc/wayback'
name: Repository Dispatch
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Dispatch repository in wabarc/aur
uses: peter-evans/repository-dispatch@v1
with:
repository: wabarc/aur
event-type: publish
token: ${{ secrets.PAT_WORKFLOW }}
client-payload: '{"from": "${{ github.repository }}", "channel": "stable"}'
- name: Dispatch repository in wabarc/on-heroku
uses: peter-evans/repository-dispatch@v1
with:
repository: wabarc/on-heroku
event-type: deploy
token: ${{ secrets.PAT_WORKFLOW }}
client-payload: '{"from": "${{ github.repository }}", "channel": "stable"}'