-
Notifications
You must be signed in to change notification settings - Fork 95
290 lines (258 loc) · 11 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
283
284
285
286
287
288
289
290
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: manifest-tool Release
jobs:
check:
name: Check Signed Tag
runs-on: ubuntu-20.04
timeout-minutes: 5
outputs:
stringver: ${{ steps.contentrel.outputs.stringver }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Check signature
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) ||
echo "${TAGCHECK}" | grep -q "error" && {
echo "::error::tag ${releasever} is not a signed tag. Failing release process."
exit 1
} || {
echo "Tag ${releasever} is signed."
exit 0
}
working-directory: src/github.com/estesp/manifest-tool
- name: Release content
id: contentrel
run: |
RELEASEVER=${{ github.ref }}
echo "::set-output name=stringver::${RELEASEVER#refs/tags/v}"
git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md
working-directory: src/github.com/estesp/manifest-tool
- name: Save release notes
uses: actions/upload-artifact@v2
with:
name: mtool-release-notes
path: src/github.com/estesp/manifest-tool/release-notes.md
build:
name: Build binaries
runs-on: ubuntu-20.04
needs: [check]
timeout-minutes: 10
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout manifest-tool
uses: actions/checkout@v3
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Make
shell: bash
run: |
make cross
TARFILE="binaries-manifest-tool-${RELEASE_VER#v}.tar.gz"
tar czf ${TARFILE} manifest-tool-*
sha256sum ${TARFILE} >${TARFILE}.sha256sum
working-directory: src/github.com/estesp/manifest-tool
- name: Save build binaries
uses: actions/upload-artifact@v2
with:
name: manifest-tool-binaries
path: src/github.com/estesp/manifest-tool/*.tar.gz*
containers-lx:
name: Build and push Linux release images
runs-on: ubuntu-20.04
needs: [check]
timeout-minutes: 30
steps:
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout manifest-tool
uses: actions/checkout@v3
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Linux containers
shell: bash
run: |
docker buildx build --platform linux/arm/v6 --push -t mplatform/manifest-tool:linux_arm_v6_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/arm/v7 --push -t mplatform/manifest-tool:linux_arm_v7_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/amd64 --push -t mplatform/manifest-tool:linux_amd64_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/arm64 --push -t mplatform/manifest-tool:linux_arm64_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/ppc64le --push -t mplatform/manifest-tool:linux_ppc64le_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/s390x --push -t mplatform/manifest-tool:linux_s390x_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/386 --push -t mplatform/manifest-tool:linux_i386_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/riscv64 --push -t mplatform/manifest-tool:linux_riscv64_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/arm/v6 --push -t mplatform/manifest-tool:alpine_linux_arm_v6_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/arm/v7 --push -t mplatform/manifest-tool:alpine_linux_arm_v7_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/amd64 --push -t mplatform/manifest-tool:alpine_linux_amd64_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/arm64 --push -t mplatform/manifest-tool:alpine_linux_arm64_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/ppc64le --push -t mplatform/manifest-tool:alpine_linux_ppc64le_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/s390x --push -t mplatform/manifest-tool:alpine_linux_s390x_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/386 --push -t mplatform/manifest-tool:alpine_linux_i386_${RELEASE_VER} -f hack/Dockerfile.alpine .
working-directory: src/github.com/estesp/manifest-tool
containers-win:
name: Build and push Windows release images
runs-on: windows-2019
needs: [check]
timeout-minutes: 30
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout manifest-tool
uses: actions/checkout@v3
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Windows containers
shell: bash
run: |
make binary
docker build -t mplatform/manifest-tool:win2019_${RELEASE_VER} -f hack/Dockerfile.windows .
docker build -t mplatform/manifest-tool:win2016_${RELEASE_VER} -f hack/Dockerfile.windows2016 .
docker push mplatform/manifest-tool:win2019_${RELEASE_VER}
docker push mplatform/manifest-tool:win2016_${RELEASE_VER}
working-directory: src/github.com/estesp/manifest-tool
container-assemble:
name: Assemble and push multi-platform release image
runs-on: ubuntu-20.04
needs: [containers-lx, containers-win]
timeout-minutes: 15
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout manifest-tool
uses: actions/checkout@v3
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Build and push manifest-list
env:
PRERELEASE: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
shell: bash
run: |
TMPROOT=$(mktemp -d)
git clone https://github.com/estesp/manifest-tool.git "${TMPROOT}"/manifest-tool
pushd "${TMPROOT}"/manifest-tool
make binary
sudo make install PREFIX=/usr/local
popd
if [ "${PRERELEASE}" == "true" ]; then
cat hack/pushml-pre.yaml | sed "s,VERS,${RELEASE_VER}," >pushml.yml
else
cat hack/pushml.yaml | sed "s,VERS,${RELEASE_VER}," >pushml.yml
cat hack/pushml-alpine.yaml | sed "s,VERS,${RELEASE_VER}," >pushml-alpine.yml
fi
/usr/local/bin/manifest-tool push from-spec pushml.yml
/usr/local/bin/manifest-tool push from-spec pushml-alpine.yml
working-directory: src/github.com/estesp/manifest-tool
release:
name: Create manifest-tool Release
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [build, check]
steps:
- name: Download builds and release notes
uses: actions/download-artifact@v2
with:
path: builds
- name: Catalog build assets for upload
id: catalog
run: |
_filenum=1
for f in `ls builds/manifest-tool-binaries`; do
echo "::set-output name=file${_filenum}::${f}"
let "_filenum+=1"
done
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: manifest-tool ${{ needs.check.outputs.stringver }}
body_path: ./builds/mtool-release-notes/release-notes.md
draft: false
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Upload binaries tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/manifest-tool-binaries/${{ steps.catalog.outputs.file1 }}
asset_name: ${{ steps.catalog.outputs.file1 }}
asset_content_type: application/gzip
- name: Upload sha256 sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/manifest-tool-binaries/${{ steps.catalog.outputs.file2 }}
asset_name: ${{ steps.catalog.outputs.file2 }}
asset_content_type: text/plain