Skip to content

Commit c2b133b

Browse files
committed
Support Github Actions
1 parent b8177ff commit c2b133b

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

.github/workflows/release.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: "Release"
2+
3+
on:
4+
push:
5+
tags:
6+
- v3*
7+
8+
jobs:
9+
k8s:
10+
name: release-k8s
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
# The github.ref is, for example, refs/tags/v3.0.145 or refs/tags/v3.0-r8
18+
# Generate variables like:
19+
# SRS_TAG=v3.0.145
20+
# SRS_TAG=v3.0-r8
21+
# SRS_MAJOR=3
22+
# @see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
23+
- name: Generate varaiables
24+
shell: bash
25+
run: |
26+
SRS_TAG=$(echo ${{ github.ref }}| awk -F '/' '{print $3}')
27+
echo "SRS_TAG=$SRS_TAG" >> $GITHUB_ENV
28+
SRS_MAJOR=$(echo $SRS_TAG| cut -c 2)
29+
echo "SRS_MAJOR=$SRS_MAJOR" >> $GITHUB_ENV
30+
31+
- name: Build SRS
32+
shell: bash
33+
run: |
34+
echo "Release ossrs/srs:$SRS_TAG"
35+
docker build --tag ossrs/srs:$SRS_TAG trunk
36+
37+
- name: Login docker hub
38+
uses: docker/login-action@v1
39+
with:
40+
username: "${{ secrets.DOCKER_USERNAME }}"
41+
password: "${{ secrets.DOCKER_PASSWORD }}"
42+
- name: Push to docker hub
43+
shell: bash
44+
run: |
45+
docker push ossrs/srs:$SRS_TAG
46+
docker tag ossrs/srs:$SRS_TAG ossrs/srs:$SRS_MAJOR
47+
docker push ossrs/srs:$SRS_MAJOR
48+
49+
- name: Login Aliyun docker hub
50+
uses: aliyun/acr-login@v1
51+
with:
52+
login-server: https://registry.cn-hangzhou.aliyuncs.com
53+
username: "${{ secrets.ACR_USERNAME }}"
54+
password: "${{ secrets.ACR_PASSWORD }}"
55+
- name: Push to Aliyun docker hub
56+
shell: bash
57+
run: |
58+
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
59+
docker push registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
60+
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_MAJOR
61+
docker push registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_MAJOR
62+
63+
- name: Setup KUBCONFIG for Aliyun ACK
64+
shell: bash
65+
run: |-
66+
KUBECONFIG=$RUNNER_TEMP/kubeconfig_$(date +%s)
67+
echo "${{ secrets.KUBCONFIG }}" > $KUBECONFIG
68+
echo "KUBECONFIG=$KUBECONFIG" >> $GITHUB_ENV
69+
70+
- name: Release SRS 3.0 to Aliyun ACK
71+
shell: bash
72+
if: ${{ startsWith(github.ref, 'refs/tags/v3') }}
73+
run: |-
74+
kubectl set image deploy/srs3-deploy srs=registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
75+
kubectl describe deploy/srs3-deploy

trunk/Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ossrs/srs:dev AS build
2+
3+
# Install depends tools.
4+
RUN yum install -y gcc make gcc-c++ patch unzip perl git
5+
6+
# Build and install SRS.
7+
COPY . /trunk
8+
WORKDIR /trunk
9+
RUN ./configure --jobs=2 && make -j2 && make install
10+
11+
# All config files for SRS.
12+
RUN cp -R conf /usr/local/srs/conf
13+
# The default index.html and srs-console.
14+
RUN cp research/api-server/static-dir/index.html /usr/local/srs/objs/nginx/html/
15+
RUN cp research/api-server/static-dir/favicon.ico /usr/local/srs/objs/nginx/html/
16+
RUN cp research/players/crossdomain.xml /usr/local/srs/objs/nginx/html/
17+
RUN cp -R research/console /usr/local/srs/objs/nginx/html/
18+
RUN cp -R research/players /usr/local/srs/objs/nginx/html/
19+
#RUN cp -R 3rdparty/signaling/www/demos /usr/local/srs/objs/nginx/html/
20+
21+
############################################################
22+
# dist
23+
############################################################
24+
FROM centos:7 AS dist
25+
26+
# Expose ports for streaming @see https://github.com/ossrs/srs#ports
27+
EXPOSE 1935 1985 8080 8000/udp 10080/udp
28+
29+
# FFMPEG 4.1
30+
COPY --from=build /usr/local/bin/ffmpeg /usr/local/srs/objs/ffmpeg/bin/ffmpeg
31+
# SRS binary, config files and srs-console.
32+
COPY --from=build /usr/local/srs /usr/local/srs
33+
34+
# Default workdir and command.
35+
WORKDIR /usr/local/srs
36+
CMD ["./objs/srs", "-c", "conf/srs.conf"]

0 commit comments

Comments
 (0)