-
-
Notifications
You must be signed in to change notification settings - Fork 51
423 lines (373 loc) · 18.3 KB
/
build_and_publish_release.yaml
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: Build and publish release
on:
workflow_dispatch:
inputs:
tag:
description: "Release Tag"
required: true
type: string
jobs:
get_semver:
name: Get Semantic Version
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.semver.outputs.semver }}
steps:
- id: semver
env:
RELEASE_VERSION: ${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
run: |
if [[ "${RELEASE_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "semver=${RELEASE_VERSION/v/}" >> "$GITHUB_OUTPUT"
else
# If ref name does not match semver, default to 0.0.0
# This happens when running from a branch such as main
echo "semver=0.0.0" >> "$GITHUB_OUTPUT"
# Exit with an error because releases from branches should not be made
exit 1
fi
# Note: When modifying this job, copy modifications to all other workflow image jobs
core_images:
needs: get_semver
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: gst-web
context: addons/gst-web
- name: py-build
build_args: |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }}
context: .
name: ${{ matrix.name }}${{ matrix.version_suffix }} image build & publish
steps:
- uses: actions/checkout@v4
- name: Build & publish ${{ matrix.name }} image
uses: ./.github/actions/build_and_publish_image
with:
build_args: ${{ matrix.build_args }}
context: ${{ matrix.context }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
push: ${{ github.event_name != 'pull_request' }}
subproject: ${{ matrix.name }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }}
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest${{ matrix.version_suffix }}
# Note: When modifying this job, copy modifications to all other workflow image jobs
component_images:
needs:
- get_semver
- core_images
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: conda
build_args: |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }}
PKG_VERSION=${{ needs.get_semver.outputs.semver }}
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
context: addons/conda
- name: coturn
context: addons/coturn
platforms: linux/amd64,linux/arm64
- name: coturn-web
context: addons/coturn-web
platforms: linux/amd64,linux/arm64
- name: gstreamer
version_suffix: -ubuntu20.04
build_args: |
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=20.04
context: addons/gstreamer
- name: gstreamer
version_suffix: -ubuntu22.04
build_args: |
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=22.04
context: addons/gstreamer
- name: gstreamer
version_suffix: -ubuntu24.04
build_args: |
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=24.04
context: addons/gstreamer
- name: js-interposer
version_suffix: -ubuntu20.04
build_args: |
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=20.04
PKG_NAME=selkies-js-interposer
PKG_VERSION=${{ needs.get_semver.outputs.semver }}
context: addons/js-interposer
dockerfile: Dockerfile.debpkg
platforms: linux/amd64,linux/arm64
- name: js-interposer
version_suffix: -ubuntu22.04
build_args: |
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=22.04
PKG_NAME=selkies-js-interposer
PKG_VERSION=${{ needs.get_semver.outputs.semver }}
context: addons/js-interposer
dockerfile: Dockerfile.debpkg
platforms: linux/amd64,linux/arm64
- name: js-interposer
version_suffix: -ubuntu24.04
build_args: |
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=24.04
PKG_NAME=selkies-js-interposer
PKG_VERSION=${{ needs.get_semver.outputs.semver }}
context: addons/js-interposer
dockerfile: Dockerfile.debpkg
platforms: linux/amd64,linux/arm64
- name: turn-rest
context: addons/turn-rest
platforms: linux/amd64,linux/arm64
- name: infra-gcp-installer
context: infra/gce/installer-image
diff: infra/gce
name: ${{ matrix.name }}${{ matrix.version_suffix }} image build & publish
steps:
- uses: actions/checkout@v4
- name: Build & publish ${{ matrix.name }} image
uses: ./.github/actions/build_and_publish_image
with:
build_args: ${{ matrix.build_args }}
context: ${{ matrix.context }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
push: ${{ github.event_name != 'pull_request' }}
subproject: ${{ matrix.name }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }}
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest${{ matrix.version_suffix }}
# Note: When modifying this job, copy modifications to all other workflow image jobs
example_images:
needs:
- get_semver
- core_images
- component_images
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: gst-py-example
version_suffix: -ubuntu20.04
build_args: |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }}
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=20.04
GSTREAMER_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
JS_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
JS_BASE_IMAGE=ghcr.io/${{ github.repository }}/js-interposer
context: addons/example
- name: gst-py-example
version_suffix: -ubuntu22.04
build_args: |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }}
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=22.04
GSTREAMER_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
JS_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
JS_BASE_IMAGE=ghcr.io/${{ github.repository }}/js-interposer
context: addons/example
- name: gst-py-example
version_suffix: -ubuntu24.04
build_args: |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }}
DISTRIB_IMAGE=ubuntu
DISTRIB_RELEASE=24.04
GSTREAMER_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
JS_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}
JS_BASE_IMAGE=ghcr.io/${{ github.repository }}/js-interposer
context: addons/example
name: ${{ matrix.name }}${{ matrix.version_suffix }} image build & publish
steps:
- uses: actions/checkout@v4
- name: Build & publish ${{ matrix.name }} image
uses: ./.github/actions/build_and_publish_image
with:
build_args: ${{ matrix.build_args }}
context: ${{ matrix.context }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
push: ${{ github.event_name != 'pull_request' }}
subproject: ${{ matrix.name }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }}
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest${{ matrix.version_suffix }}
upload_artifacts:
needs:
- get_semver
- core_images
- component_images
- example_images
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
env:
TMPDIR: /tmp
strategy:
matrix:
include:
- name: conda
source: /opt/selkies-gstreamer-conda.tar.gz
target: selkies-gstreamer-portable-${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_amd64.tar.gz
- name: gst-web
source: /opt/gst-web.tar.gz
target: selkies-gstreamer-web_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}.tar.gz
- name: gstreamer
version_suffix: -ubuntu20.04
source: /opt/selkies-gstreamer-latest.tar.gz
target: gstreamer-selkies_gpl_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_amd64.tar.gz
- name: gstreamer
version_suffix: -ubuntu22.04
source: /opt/selkies-gstreamer-latest.tar.gz
target: gstreamer-selkies_gpl_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_amd64.tar.gz
- name: gstreamer
version_suffix: -ubuntu24.04
source: /opt/selkies-gstreamer-latest.tar.gz
target: gstreamer-selkies_gpl_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_amd64.tar.gz
- name: js-interposer
version_suffix: -ubuntu20.04
suffix: -deb
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_amd64.deb
- name: js-interposer
version_suffix: -ubuntu22.04
suffix: -deb
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_amd64.deb
- name: js-interposer
version_suffix: -ubuntu24.04
suffix: -deb
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_amd64.deb
- name: js-interposer
version_suffix: -ubuntu20.04
suffix: -deb
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_arm64.deb
platforms: linux/arm64
- name: js-interposer
version_suffix: -ubuntu22.04
suffix: -deb
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_arm64.deb
platforms: linux/arm64
- name: js-interposer
version_suffix: -ubuntu24.04
suffix: -deb
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_arm64.deb
platforms: linux/arm64
- name: js-interposer
version_suffix: -ubuntu20.04
suffix: -tar.gz
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_amd64.tar.gz
- name: js-interposer
version_suffix: -ubuntu22.04
suffix: -tar.gz
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_amd64.tar.gz
- name: js-interposer
version_suffix: -ubuntu24.04
suffix: -tar.gz
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_amd64.tar.gz
- name: js-interposer
version_suffix: -ubuntu20.04
suffix: -tar.gz
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_arm64.tar.gz
platforms: linux/arm64
- name: js-interposer
version_suffix: -ubuntu22.04
suffix: -tar.gz
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_arm64.tar.gz
platforms: linux/arm64
- name: js-interposer
version_suffix: -ubuntu24.04
suffix: -tar.gz
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_arm64.tar.gz
platforms: linux/arm64
- name: py-build
source: /opt/pypi/dist/selkies_gstreamer-${{ needs.get_semver.outputs.semver }}-py3-none-any.whl
target: selkies_gstreamer-${{ needs.get_semver.outputs.semver }}-py3-none-any.whl
name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ matrix.platforms || 'linux/amd64' }} release artifact extraction & upload
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ matrix.platforms || 'linux/amd64' }} release artifact extraction
run: |
docker container create --name=copy --platform="${{ matrix.platforms || 'linux/amd64' }}" "ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }}"
TARGET_PATH="${{ env.TMPDIR }}/${{ matrix.target }}"
docker container cp "copy:${{ matrix.source }}" "${TARGET_PATH}"
if [ -d "${TARGET_PATH}" ]; then
SOURCE_DIRNAME=$(echo "${{ matrix.source }}" | sed 's:.*/::')
cd "${{ env.TMPDIR }}" && mv -f "${TARGET_PATH}" "${SOURCE_DIRNAME}"
tar -czvf "temp.tar.gz" "${SOURCE_DIRNAME}" && rm -rf "${SOURCE_DIRNAME}" && mv -f "temp.tar.gz" "${TARGET_PATH}"
fi
docker container rm --force --volumes copy
echo "release_arch=$(echo ${{ matrix.platforms || 'linux/amd64' }} | sed -e 's/\//\-/')" >> "$GITHUB_ENV"
- name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ matrix.platforms || 'linux/amd64' }} upload
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
overwrite: true
name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ env.release_arch }}
path: ${{ env.TMPDIR }}/${{ matrix.target }}
create_release:
needs:
- get_semver
- core_images
- component_images
- example_images
- upload_artifacts
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
env:
TMPDIR: /tmp
name: Create v${{ needs.get_semver.outputs.semver }} draft release
steps:
- name: Download v${{ needs.get_semver.outputs.semver }} artifacts
id: artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ${{ env.TMPDIR }}/artifacts
- name: Create v${{ needs.get_semver.outputs.semver }} draft release
uses: softprops/action-gh-release@v2
with:
name: "Release v${{ needs.get_semver.outputs.semver }}"
tag_name: v${{ needs.get_semver.outputs.semver }}
append_body: true
body: "**By downloading the GStreamer build files or the portable distribution, you acknowledge, agree, and adhere to the terms of works licensed under (L)GPLv2, (L)GPLv3, and https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/LICENSE.txt licenses, as well as other terms of intellectual property, including but not limited to patents.**"
draft: true
generate_release_notes: true
fail_on_unmatched_files: true
files: |
${{ steps.artifact.outputs.download-path }}/*