-
Notifications
You must be signed in to change notification settings - Fork 39
127 lines (119 loc) · 4.55 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
name: "Release"
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
on:
push:
branches:
- 'cygwin64-cache'
jobs:
envs:
name: envs
runs-on: ubuntu-20.04
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.0-r8
# SRS_TAG=v5.0.145
# @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}')
echo "SRS_TAG=$SRS_TAG" >> $GITHUB_ENV
outputs:
SRS_TAG: ${{ env.SRS_TAG }}
cygwin64:
name: cygwin64
runs-on: windows-latest
needs:
- envs
steps:
# See https://github.com/cygwin/cygwin-install-action#parameters
# Note that https://github.com/egor-tensin/setup-cygwin fails to install packages.
- name: Setup Cygwin
uses: cygwin/cygwin-install-action@master
with:
platform: x86_64
packages: bash make gcc-g++ cmake automake patch pkg-config tcl
install-dir: C:\cygwin64
##################################################################################################################
- name: Checkout repository
uses: actions/checkout@v3
##################################################################################################################
- name: Build and test SRS
env:
SHELLOPTS: igncr
SRS_WORKSPACE: ${{ github.workspace }}
shell: C:\cygwin64\bin\bash.exe --login '{0}'
run: |
cd $(cygpath -u $SRS_WORKSPACE) &&
git clone https://github.com/ossrs/srs.git &&
pwd && du -sh * && export PATH=$PATH:/usr/bin:/usr/local/bin &&
(cd srs/trunk && git checkout 5.0release && ./configure --utest=on && make utest && ./objs/srs_utest) &&
(cd srs/trunk && git checkout develop && ./configure --utest=on && make utest && ./objs/srs_utest) &&
tar jcf srs.tar.bz2 srs && pwd && du -sh *
##################################################################################################################
- uses: actions/upload-artifact@v3
with:
name: srs-cache
path: srs.tar.bz2
retention-days: 1
outputs:
SRS_CYGWIN_DONE: ok
docker:
name: docker-hub
runs-on: ubuntu-20.04
needs:
- envs
- cygwin64
steps:
##################################################################################################################
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
##################################################################################################################
- name: Checkout repository
uses: actions/checkout@v3
##################################################################################################################
- uses: actions/download-artifact@v3
with:
name: srs-cache
- uses: geekyeggo/delete-artifact@v2
with:
name: srs-cache
##################################################################################################################
- name: Login to docker hub
uses: docker/login-action@v1
with:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Build docker image
run: |
pwd && ls -lhR &&
docker build --tag ossrs/srs:$SRS_TAG .
- name: Push to docker hub
run: |
docker push ossrs/srs:$SRS_TAG
aliyun:
name: aliyun-hub
runs-on: ubuntu-20.04
needs:
- envs
- docker
steps:
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
- name: Login aliyun hub
uses: docker/login-action@v1
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- name: Push to Aliyun registry for ossrs/srs
uses: akhilerm/[email protected]
with:
src: ossrs/srs:${{ env.SRS_TAG }}
dst: |
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}