forked from containerd/containerd
-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (175 loc) · 6.5 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
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Containerd Release
jobs:
check:
name: Check Signed Tag
runs-on: ubuntu-18.04
timeout-minutes: 5
outputs:
stringver: ${{ steps.contentrel.outputs.stringver }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
path: src/github.com/containerd/containerd
- 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/containerd/containerd
- 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/containerd/containerd
- name: Save release notes
uses: actions/upload-artifact@v2
with:
name: containerd-release-notes
path: src/github.com/containerd/containerd/release-notes.md
build:
name: Build Release Binaries
runs-on: ${{ matrix.os }}
needs: [check]
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-18.04, windows-2019]
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.13.15'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "::set-env name=RELEASE_VER::${releasever}"
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- name: Checkout containerd
uses: actions/checkout@v2
with:
repository: containerd/containerd
ref: ${{ github.ref }}
path: src/github.com/containerd/containerd
- name: HCS Shim commit
id: hcsshim_commit
if: startsWith(matrix.os, 'windows')
shell: bash
run: echo "::set-output name=sha::$(grep Microsoft/hcsshim vendor.conf | awk '{print $2}')"
working-directory: src/github.com/containerd/containerd
- name: Checkout hcsshim source
if: startsWith(matrix.os, 'windows')
uses: actions/checkout@v2
with:
repository: Microsoft/hcsshim
ref: ${{ steps.hcsshim_commit.outputs.sha }}
path: src/github.com/Microsoft/hcsshim
- name: Make
shell: bash
env:
MOS: ${{ matrix.os }}
OS: linux
run: |
make build
make binaries
[[ "${MOS}" =~ "windows" ]] && {
OS=windows
(
bindir="$(pwd)/bin"
cd ../../Microsoft/hcsshim
GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1
)
}
TARFILE="containerd-${RELEASE_VER#v}-${OS}-amd64.tar.gz"
tar czf ${TARFILE} bin/
sha256sum ${TARFILE} >${TARFILE}.sha256sum
working-directory: src/github.com/containerd/containerd
- name: Save build binaries
uses: actions/upload-artifact@v2
with:
name: containerd-binaries-${{ matrix.os }}
path: src/github.com/containerd/containerd/*.tar.gz*
release:
name: Create containerd Release
runs-on: ubuntu-18.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 i in "ubuntu-18.04" "windows-2019"; do
for i in `ls builds/containerd-binaries-${i}`; do
echo "::set-output name=file${_filenum}::${i}"
let "_filenum+=1"
done
done
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: containerd ${{ needs.check.outputs.stringver }}
body_path: ./builds/containerd-release-notes/release-notes.md
draft: false
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Upload Linux containerd 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/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file1 }}
asset_name: ${{ steps.catalog.outputs.file1 }}
asset_content_type: application/gzip
- name: Upload Linux 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/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file2 }}
asset_name: ${{ steps.catalog.outputs.file2 }}
asset_content_type: text/plain
- name: Upload Windows containerd 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/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file3 }}
asset_name: ${{ steps.catalog.outputs.file3 }}
asset_content_type: application/gzip
- name: Upload Windows 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/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file4 }}
asset_name: ${{ steps.catalog.outputs.file4 }}
asset_content_type: text/plain