-
Notifications
You must be signed in to change notification settings - Fork 339
264 lines (258 loc) · 9.37 KB
/
prerelease.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
name: Build and push pre-release images
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: true
- name: Dump upload url to file
run: echo '${{ steps.create_release.outputs.upload_url }}' > upload_url
- name: Upload upload_url
uses: actions/upload-artifact@v1
with:
name: upload_url
path: upload_url
build-docker-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Build image
uses: ilteoood/docker_buildx@master
with:
publish: true
imageName: webthingsio/gateway
platform: linux/amd64,linux/arm/v7,linux/arm64
tag: ${{ env.RELEASE_VERSION }}
dockerUser: ${{ secrets.DOCKER_HUB_USER }}
dockerPassword: ${{ secrets.DOCKER_HUB_PASSWORD }}
build-raspbian-image:
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install qemu
run: |
sudo apt update
sudo apt install -y qemu qemu-user-static binfmt-support kpartx --no-install-recommends
- name: Setup qemu-user-static
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build the image
run: |
cd image
./build.sh
- name: Download upload_url
uses: actions/download-artifact@v1
with:
name: upload_url
- name: Set upload_url
run: echo "UPLOAD_URL=$(cat upload_url/upload_url)" >> $GITHUB_ENV
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Upload image
id: upload-release-asset-image
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./image/gateway-${{ env.RELEASE_VERSION }}.img.zip
asset_name: gateway-${{ env.RELEASE_VERSION }}.img.zip
asset_content_type: application/zip
- name: Upload image checksum
id: upload-release-asset-image-checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./image/gateway-${{ env.RELEASE_VERSION }}.img.zip.sha256sum
asset_name: gateway-${{ env.RELEASE_VERSION }}.img.zip.sha256sum
asset_content_type: text/plain
- name: Find OTA packages
run: |
cd image
echo "GATEWAY_TARBALL=$(ls gateway-*.tar.gz | head -n1)" >> $GITHUB_ENV
echo "MODULES_TARBALL=$(ls node_modules-*.tar.gz | head -n1)" >> $GITHUB_ENV
- name: Upload gateway package
id: upload-release-asset-gateway
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./image/${{ env.GATEWAY_TARBALL }}
asset_name: ${{ env.GATEWAY_TARBALL }}
asset_content_type: application/zip
- name: Upload node modules package
id: upload-release-asset-node-modules
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./image/${{ env.MODULES_TARBALL }}
asset_name: ${{ env.MODULES_TARBALL }}
asset_content_type: application/zip
# build-deb-packages:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# image:
# - "ubuntu:bionic"
# - "arm64v8/ubuntu:bionic"
# - "ubuntu:focal"
# - "arm64v8/ubuntu:focal"
# - "ubuntu:groovy"
# - "arm64v8/ubuntu:groovy"
# - "debian:buster"
# - "arm64v8/debian:buster"
# - "balenalib/raspberry-pi-debian:buster-20200405"
# include:
# - image: "ubuntu:bionic"
# name: "ubuntu-bionic"
# arch: "amd64"
# - image: "arm64v8/ubuntu:bionic"
# name: "ubuntu-bionic"
# arch: "arm64"
# - image: "ubuntu:focal"
# name: "ubuntu-focal"
# arch: "amd64"
# - image: "arm64v8/ubuntu:focal"
# name: "ubuntu-focal"
# arch: "arm64"
# - image: "ubuntu:groovy"
# name: "ubuntu-groovy"
# arch: "amd64"
# - image: "arm64v8/ubuntu:groovy"
# name: "ubuntu-groovy"
# arch: "arm64"
# - image: "debian:buster"
# name: "debian-buster"
# arch: "amd64"
# - image: "arm64v8/debian:buster"
# name: "debian-buster"
# arch: "arm64"
# - image: "balenalib/raspberry-pi-debian:buster-20200405"
# name: "raspbian-buster"
# arch: "armhf"
# steps:
# - name: Install qemu
# run: |
# sudo apt update
# sudo apt install -y qemu qemu-user-static binfmt-support --no-install-recommends
# - name: Setup qemu-user-static
# run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# - name: Checkout the repository
# uses: actions/checkout@v2
# - name: Generate the source tarball
# run: |
# cd deb
# ./generate-tarball.sh
# - name: Build the Package
# run: |
# cd deb
# docker pull ${{ matrix.image }}
# docker create --name build -it ${{ matrix.image }} /build/build.sh
# docker cp . build:/build
# docker start -a build
# docker cp -L build:/build/webthings-gateway.deb ./webthings-gateway-${{ matrix.name }}-${{ matrix.arch }}.deb
# docker rm build
# - name: Download upload_url
# uses: actions/download-artifact@v1
# with:
# name: upload_url
# - name: Set upload_url
# run: echo "UPLOAD_URL=$(cat upload_url/upload_url)" >> $GITHUB_ENV
# - name: Upload .deb package
# id: upload-release-asset-deb
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ env.UPLOAD_URL }}
# asset_path: deb/webthings-gateway-${{ matrix.name }}-${{ matrix.arch }}.deb
# asset_name: webthings-gateway-${{ matrix.name }}-${{ matrix.arch }}.deb
# asset_content_type: application/zip
# build-rpm-packages:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# image:
# - "fedora:31"
# - "arm64v8/fedora:31"
# - "fedora:32"
# - "arm64v8/fedora:32"
# - "fedora:33"
# - "arm64v8/fedora:33"
# include:
# - image: "fedora:31"
# name: "fedora-31"
# arch: "x86_64"
# - image: "arm64v8/fedora:31"
# name: "fedora-31"
# arch: "aarch64"
# - image: "fedora:32"
# name: "fedora-32"
# arch: "x86_64"
# - image: "arm64v8/fedora:32"
# name: "fedora-32"
# arch: "aarch64"
# - image: "fedora:33"
# name: "fedora-33"
# arch: "x86_64"
# - image: "arm64v8/fedora:33"
# name: "fedora-33"
# arch: "aarch64"
# steps:
# - name: Install qemu
# run: |
# sudo apt update
# sudo apt install -y qemu qemu-user-static binfmt-support --no-install-recommends
# - name: Setup qemu-user-static
# run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# - name: Checkout the repository
# uses: actions/checkout@v2
# - name: Generate the source tarball
# run: |
# cd rpm
# ./generate-tarball.sh
# - name: Build the Package
# run: |
# cd rpm
# docker pull ${{ matrix.image }}
# docker create --name build -it ${{ matrix.image }} /build/build.sh
# docker cp . build:/build
# docker start -a build
# docker cp -L build:/build/webthings-gateway.rpm ./webthings-gateway-${{ matrix.name }}-${{ matrix.arch }}.rpm
# docker rm build
# - name: Download upload_url
# uses: actions/download-artifact@v1
# with:
# name: upload_url
# - name: Set upload_url
# run: echo "UPLOAD_URL=$(cat upload_url/upload_url)" >> $GITHUB_ENV
# - name: Upload .rpm package
# id: upload-release-asset-rpm
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ env.UPLOAD_URL }}
# asset_path: rpm/webthings-gateway-${{ matrix.name }}-${{ matrix.arch }}.rpm
# asset_name: webthings-gateway-${{ matrix.name }}-${{ matrix.arch }}.rpm
# asset_content_type: application/zip