-
-
Notifications
You must be signed in to change notification settings - Fork 118
276 lines (266 loc) · 13.3 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
name: "Release New Version"
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
on:
push:
tags:
- v*
jobs:
check-test-dev:
steps:
- name: Wait for Test Workflow
uses: fountainhead/action-wait-for-check@v1.1.0
id: wait-for-test
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: test-final
ref: ${{ github.sha }}
timeoutSeconds: 3600
- name: Check Test Workflow result
if: steps.wait-for-test.outputs.conclusion != 'success'
run: |
echo "Test Workflow failed, aborting release" && exit 1
runs-on: ubuntu-20.04
check-test-online:
steps:
- name: Wait for Test Online Workflow
uses: fountainhead/action-wait-for-check@v1.1.0
id: wait-for-test
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: test-online-final
ref: ${{ github.sha }}
timeoutSeconds: 3600
- name: Check Test Workflow result
if: steps.wait-for-test.outputs.conclusion != 'success'
run: |
echo "Test Workflow failed, aborting release" && exit 1
runs-on: ubuntu-20.04
envs:
needs:
- check-test-dev
- check-test-online
name: envs
steps:
# Git checkout
- name: Checkout repository
uses: actions/checkout@v3
# The github.ref is, for example, refs/tags/v5.0.145 or refs/tags/v5.0-r8
# Generate variables like:
# SRS_TAG=v5.8.20
# SRS_MAJOR=5
# @see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Generate varaiables
run: |
SRS_TAG=$(echo ${{ github.ref }}| awk -F '/' '{print $3}')
SRS_MAJOR=$(echo $SRS_TAG| awk -F '.' '{print $1}' |sed 's/v//g')
echo "SRS_TAG=$SRS_TAG" >> $GITHUB_ENV
echo "SRS_MAJOR=$SRS_MAJOR" >> $GITHUB_ENV
echo "SRS_TAG:$SRS_TAG, SRS_MAJOR:$SRS_MAJOR"
# Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
SRS_TAG: ${{ env.SRS_TAG }}
SRS_MAJOR: ${{ env.SRS_MAJOR }}
runs-on: ubuntu-20.04
docker:
needs:
- envs
steps:
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV
# Git checkout
- name: Checkout repository
uses: actions/checkout@v3
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Create main images for Docker
- name: Login to docker hub
uses: docker/login-action@v2
with:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Build the ui for multiple archs
run: |
echo "Build multiple language ui"
cd ui && make build-cn -j && make build-en -j
- name: Build SRS docker image
run: |
echo "Release ossrs/srs-stack:$SRS_TAG"
docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \
--output "type=image,push=true" --build-arg MAKEARGS=build-no-ui \
--tag ossrs/srs-stack:$SRS_TAG -f Dockerfile .
- name: Docker alias images for ossrs/srs-stack
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ossrs/srs-stack:${{ env.SRS_TAG }}
dst: |
ossrs/srs-cloud:${{ env.SRS_TAG }}
ossrs/srs-cloud:platform-${{ env.SRS_TAG }}
# TODO: FIXME: If stable release, update it.
#ossrs/srs-stack:${{ env.SRS_MAJOR }}
#ossrs/srs-stack:v${{ env.SRS_MAJOR }}
#ossrs/srs-cloud:${{ env.SRS_MAJOR }}
#ossrs/srs-cloud:v${{ env.SRS_MAJOR }}
#ossrs/srs-cloud:platform-${{ env.SRS_MAJOR }}
#ossrs/srs-cloud:platform-v${{ env.SRS_MAJOR }}
runs-on: ubuntu-20.04
aliyun:
needs:
- envs
- docker
steps:
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV
# Aliyun ACR
- name: Login Aliyun docker hub
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- name: Docker alias images for ossrs/srs-stack
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ossrs/srs-stack:${{ env.SRS_TAG }}
dst: |
registry.cn-hangzhou.aliyuncs.com/ossrs/srs-stack:${{ env.SRS_TAG }}
registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:${{ env.SRS_TAG }}
registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:platform-${{ env.SRS_TAG }}
# TODO: FIXME: If stable release, update it.
#registry.cn-hangzhou.aliyuncs.com/ossrs/srs-stack:${{ env.SRS_MAJOR }}
#registry.cn-hangzhou.aliyuncs.com/ossrs/srs-stack:v${{ env.SRS_MAJOR }}
#registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:${{ env.SRS_MAJOR }}
#registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:v${{ env.SRS_MAJOR }}
#registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:platform-${{ env.SRS_MAJOR }}
#registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:platform-v${{ env.SRS_MAJOR }}
runs-on: ubuntu-20.04
draft:
name: draft
needs:
- envs
- aliyun
steps:
- name: Create release draft
id: create_draft
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allowUpdates: true
tag: ${{ github.ref }}
draft: true
# TODO: FIXME: If stable release, update it.
prerelease: true
# Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
SRS_RELEASE_ID: ${{ steps.create_draft.outputs.id }}
runs-on: ubuntu-20.04
plugin:
name: release-publication
runs-on: ubuntu-20.04
needs:
- draft
- envs
steps:
##################################################################################################################
- name: Checkout repository
uses: actions/checkout@v3
##################################################################################################################
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
echo "SRS_RELEASE_ID=${{ needs.draft.outputs.SRS_RELEASE_ID }}" >> $GITHUB_ENV
##################################################################################################################
# Create source tar for release. Note that it's for OpenWRT package srs-server, so the filename MUST be
# srs-server-xxx.tar.gz, because the package is named srs-server.
# Generate variables like:
# SRS_BT_SOURCE_FILE=srs_stack.zip
# SRS_BT_SOURCE_MD5=83e38700a80a26e30b2df054e69956e5
# SRS_SOURCE_PATH=/tmp/srs_stack-asserts/*.zip
- name: Create source tar.gz
run: |
#
# For BT
bash scripts/setup-bt/auto/zip.sh --output /tmp/zip-for-bt && SRS_BT_SOURCE_FILE=bt-srs_stack.zip &&
echo "SRS_BT_SOURCE_FILE=${SRS_BT_SOURCE_FILE}" >> $GITHUB_ENV &&
echo "SRS_BT_SOURCE_MD5=$(md5sum /tmp/zip-for-bt/${SRS_BT_SOURCE_FILE}| awk '{print $1}')" >> $GITHUB_ENV
#
# For aaPanel
bash scripts/setup-aapanel/auto/zip.sh --output /tmp/zip-for-aapanel && SRS_AAPANEL_SOURCE_FILE=aapanel-srs_stack.zip &&
echo "SRS_AAPANEL_SOURCE_FILE=${SRS_AAPANEL_SOURCE_FILE}" >> $GITHUB_ENV &&
echo "SRS_AAPANEL_SOURCE_MD5=$(md5sum /tmp/zip-for-aapanel/${SRS_AAPANEL_SOURCE_FILE}| awk '{print $1}')" >> $GITHUB_ENV
#
# For Ubuntu script: zh
bash scripts/setup-ubuntu/build.sh --output /tmp/zip-for-ubuntu --language zh && SRS_UBUNTU_ZH_SOURCE_FILE=linux-srs_stack-zh.tar.gz &&
echo "SRS_UBUNTU_ZH_SOURCE_FILE=${SRS_UBUNTU_ZH_SOURCE_FILE}" >> $GITHUB_ENV &&
echo "SRS_UBUNTU_ZH_SOURCE_FILE_MD5=$(md5sum /tmp/zip-for-ubuntu/${SRS_UBUNTU_ZH_SOURCE_FILE}| awk '{print $1}')" >> $GITHUB_ENV
#
# For Ubuntu script: en
bash scripts/setup-ubuntu/build.sh --output /tmp/zip-for-ubuntu --language en && SRS_UBUNTU_EN_SOURCE_FILE=linux-srs_stack-en.tar.gz &&
echo "SRS_UBUNTU_EN_SOURCE_FILE=${SRS_UBUNTU_EN_SOURCE_FILE}" >> $GITHUB_ENV &&
echo "SRS_UBUNTU_EN_SOURCE_FILE_MD5=$(md5sum /tmp/zip-for-ubuntu/${SRS_UBUNTU_EN_SOURCE_FILE}| awk '{print $1}')" >> $GITHUB_ENV
#
echo "Gather asserts"
SRS_SOURCE_PATH=/tmp/srs_stack-asserts && rm -rf $SRS_SOURCE_PATH && mkdir -p $SRS_SOURCE_PATH &&
mv /tmp/zip-for-bt/${SRS_BT_SOURCE_FILE} $SRS_SOURCE_PATH &&
mv /tmp/zip-for-aapanel/${SRS_AAPANEL_SOURCE_FILE} $SRS_SOURCE_PATH &&
mv /tmp/zip-for-ubuntu/${SRS_UBUNTU_ZH_SOURCE_FILE} $SRS_SOURCE_PATH &&
mv /tmp/zip-for-ubuntu/${SRS_UBUNTU_EN_SOURCE_FILE} $SRS_SOURCE_PATH &&
ls -lh $SRS_SOURCE_PATH &&
echo "SRS_SOURCE_PATH=${SRS_SOURCE_PATH}/*" >> $GITHUB_ENV
##################################################################################################################
# Upload release source files
- name: Upload Release Assets Source
id: upload-release-assets-source
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ env.SRS_RELEASE_ID }}
assets_path: ${{ env.SRS_SOURCE_PATH }}
##################################################################################################################
- name: Update release
id: update_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SRS_TAG: ${{ env.SRS_TAG }}
with:
allowUpdates: true
tag: ${{ github.ref }}
name: Release SRS Stack ${{ env.SRS_TAG }}
body: |
[${{ github.event.head_commit.message }}](https://github.com/ossrs/srs-stack/commit/${{ github.sha }})
## English
* [docker pull ossrs/srs-stack:5](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started-stack#docker)
* [docker pull ossrs/srs-stack:${{ env.SRS_TAG }}](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started-stack#docker)
* [DigitalOcean](https://marketplace.digitalocean.com/apps/srs): [Tutorial](https://blog.ossrs.io/how-to-setup-a-video-streaming-service-by-1-click-e9fe6f314ac6)
* Ubuntu Script: ${{ env.SRS_UBUNTU_EN_SOURCE_FILE_MD5 }} [${{ env.SRS_UBUNTU_EN_SOURCE_FILE }}](https://github.com/ossrs/srs-stack/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_UBUNTU_EN_SOURCE_FILE }})
* [aaPanel](https://aapanel.com) Plugin: ${{ env.SRS_AAPANEL_SOURCE_MD5 }} [${{ env.SRS_AAPANEL_SOURCE_FILE }}](https://github.com/ossrs/srs-stack/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_AAPANEL_SOURCE_FILE }})
* [Changelog](https://ossrs.io/lts/en-us/faq-srs-stack#changelog)
* [Features](https://ossrs.io/lts/en-us/faq-srs-stack#features)
## Chinese
* [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs-stack:${{ env.SRS_TAG }}](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started-stack#docker)
* [Lighthouse](https://mp.weixin.qq.com/s/fWmdkw-2AoFD_pEmE_EIkA): [Tutorial](https://www.bilibili.com/video/BV1844y1L7dL)
* Ubuntu Script: ${{ env.SRS_UBUNTU_ZH_SOURCE_FILE_MD5 }} [${{ env.SRS_UBUNTU_ZH_SOURCE_FILE }}](https://gitee.com/ossrs/srs-stack/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_UBUNTU_ZH_SOURCE_FILE }})
* [BT](https://bt.cn) Plugin: ${{ env.SRS_BT_SOURCE_MD5 }} [${{ env.SRS_BT_SOURCE_FILE }}](https://gitee.com/ossrs/srs-stack/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_BT_SOURCE_FILE }})
* [aaPanel](https://aapanel.com) Plugin: ${{ env.SRS_AAPANEL_SOURCE_MD5 }} [${{ env.SRS_AAPANEL_SOURCE_FILE }}](https://gitee.com/ossrs/srs-stack/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_AAPANEL_SOURCE_FILE }})
* [Changelog](https://ossrs.net/lts/zh-cn/faq-srs-stack#changelog)
* [Features](https://ossrs.net/lts/zh-cn/faq-srs-stack#features)
# TODO: FIXME: If stable release, update it.
## English
#* [docker pull ossrs/srs-stack:5](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started-stack#docker)
## Chinese
#* [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs-stack:5](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started-stack#docker)
draft: false
# TODO: FIXME: If stable release, update it.
prerelease: true
makeLatest: false