2021-08-14 12:46:52 +00:00
name : "Release"
2021-08-15 11:01:55 +00:00
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
2021-08-14 12:46:52 +00:00
on :
push :
tags :
2021-08-14 13:06:49 +00:00
- v4*
2021-08-14 12:46:52 +00:00
jobs :
k8s :
name : release-k8s
runs-on : ubuntu-20.04
steps :
2022-01-17 06:13:42 +00:00
##################################################################################################################
##################################################################################################################
##################################################################################################################
2021-08-14 13:24:36 +00:00
# Git checkout
2021-08-14 12:46:52 +00:00
- name : Checkout repository
uses : actions/checkout@v2
2022-01-17 06:13:42 +00:00
2021-10-02 11:27:36 +00:00
# The github.ref is, for example, refs/tags/v4.0.145 or refs/tags/v4.0-r8
# Generate variables like:
# SRS_TAG=v4.0-r8
2021-11-01 23:34:45 +00:00
# SRS_TAG=v4.0.145
# SRS_VERSION=4.0.145
2021-12-01 01:20:02 +00:00
# SRS_VERSION=4.0-r8
2021-10-02 11:27:36 +00:00
# SRS_MAJOR=4
# @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
2021-11-01 23:34:45 +00:00
SRS_VERSION=$(echo ${SRS_TAG}| sed 's/^v//g')
echo "SRS_VERSION=$SRS_VERSION" >> $GITHUB_ENV
2021-10-02 11:27:36 +00:00
SRS_MAJOR=$(echo $SRS_TAG| cut -c 2)
echo "SRS_MAJOR=$SRS_MAJOR" >> $GITHUB_ENV
2021-08-14 12:46:52 +00:00
2021-08-14 13:24:36 +00:00
# Tests
- name : Build test image
2021-09-05 06:43:02 +00:00
run : docker build --tag srs:test -f trunk/Dockerfile.test .
2021-08-14 13:24:36 +00:00
# For utest
- name : Run SRS utest
2021-12-02 12:15:28 +00:00
run : docker run --rm srs:test bash -c 'make utest && ./objs/srs_utest'
2021-08-14 13:24:36 +00:00
# For regression-test
- name : Run SRS regression-test
run : docker run --rm srs:test bash -c 'make && ./objs/srs -c conf/regression-test.conf && cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v'
2022-01-17 06:13:42 +00:00
##################################################################################################################
##################################################################################################################
##################################################################################################################
# Build SRS docker images
2021-08-14 13:24:36 +00:00
- name : Build SRS docker image
2022-01-13 09:01:57 +00:00
env :
PACKAGER : ${{ secrets.SRS_PACKAGER_DOCKER }}
2022-01-17 06:13:42 +00:00
PACKAGER_DROPLET : ${{ secrets.SRS_PACKAGER_DROPLET }}
2022-01-21 09:06:15 +00:00
PACKAGER_LIGHTHOUSE : ${{ secrets.SRS_PACKAGER_LIGHTHOUSE }}
2021-08-14 12:46:52 +00:00
run : |
echo "Release ossrs/srs:$SRS_TAG"
2022-01-13 09:01:57 +00:00
docker build --tag ossrs/srs:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER -f trunk/Dockerfile .
2022-01-17 06:13:42 +00:00
echo "Release ossrs/droplet:$SRS_TAG"
docker build --tag ossrs/droplet:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER_DROPLET -f trunk/Dockerfile .
2022-01-21 09:06:15 +00:00
echo "Release ossrs/lighthouse:$SRS_TAG"
docker build --tag ossrs/lighthouse:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER_LIGHTHOUSE -f trunk/Dockerfile .
2021-08-14 12:46:52 +00:00
2022-01-17 06:13:42 +00:00
# Docker hub
2021-08-14 12:46:52 +00:00
- name : Login docker hub
uses : docker/login-action@v1
with :
username : "${{ secrets.DOCKER_USERNAME }}"
password : "${{ secrets.DOCKER_PASSWORD }}"
- name : Push to docker hub
run : |
docker tag ossrs/srs:$SRS_TAG ossrs/srs:$SRS_MAJOR
2022-01-03 00:35:23 +00:00
docker tag ossrs/srs:$SRS_TAG ossrs/srs:latest
2022-01-17 06:13:42 +00:00
docker push --all-tags ossrs/srs
#
docker tag ossrs/droplet:$SRS_TAG ossrs/droplet:$SRS_MAJOR
docker tag ossrs/droplet:$SRS_TAG ossrs/droplet:latest
docker push --all-tags ossrs/droplet
2022-01-21 09:06:15 +00:00
#
docker tag ossrs/lighthouse:$SRS_TAG ossrs/lighthouse:$SRS_MAJOR
docker tag ossrs/lighthouse:$SRS_TAG ossrs/lighthouse:latest
docker push --all-tags ossrs/lighthouse
2022-01-17 06:13:42 +00:00
# Aliyun ACR hub
2021-08-14 12:46:52 +00:00
- name : Login Aliyun docker hub
2022-02-04 01:01:12 +00:00
uses : docker/login-action@v1
2021-08-14 12:46:52 +00:00
with :
2022-02-04 01:01:12 +00:00
registry : registry.cn-hangzhou.aliyuncs.com
2021-08-14 12:46:52 +00:00
username : "${{ secrets.ACR_USERNAME }}"
password : "${{ secrets.ACR_PASSWORD }}"
- name : Push to Aliyun docker hub
run : |
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
2021-11-15 03:23:23 +00:00
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_VERSION
2021-10-08 13:26:30 +00:00
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:v$SRS_MAJOR
2021-08-14 12:46:52 +00:00
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_MAJOR
2022-01-03 00:35:23 +00:00
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:latest
2022-01-17 06:13:42 +00:00
docker push --all-tags registry.cn-hangzhou.aliyuncs.com/ossrs/srs
#
docker tag ossrs/droplet:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/droplet:$SRS_TAG
docker tag ossrs/droplet:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/droplet:$SRS_VERSION
docker tag ossrs/droplet:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/droplet:v$SRS_MAJOR
docker tag ossrs/droplet:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/droplet:$SRS_MAJOR
docker tag ossrs/droplet:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/droplet:latest
docker push --all-tags registry.cn-hangzhou.aliyuncs.com/ossrs/droplet
2022-01-21 09:06:15 +00:00
#
docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:$SRS_TAG
docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:$SRS_VERSION
docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:v$SRS_MAJOR
docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:$SRS_MAJOR
docker tag ossrs/lighthouse:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse:latest
docker push --all-tags registry.cn-hangzhou.aliyuncs.com/ossrs/lighthouse
2021-08-14 12:46:52 +00:00
2022-02-04 01:01:12 +00:00
# Tencent TCR hub
- name : Login Tencent docker hub
uses : docker/login-action@v1
with :
registry : ccr.ccs.tencentyun.com
username : "${{ secrets.TCR_USERNAME }}"
password : "${{ secrets.TCR_PASSWORD }}"
- name : Push to Aliyun docker hub
run : |
docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:$SRS_TAG
docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:$SRS_VERSION
docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:v$SRS_MAJOR
docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:$SRS_MAJOR
docker tag ossrs/srs:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/srs:latest
docker push --all-tags ccr.ccs.tencentyun.com/ossrs/srs
#
docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:$SRS_TAG
docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:$SRS_VERSION
docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:v$SRS_MAJOR
docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:$SRS_MAJOR
docker tag ossrs/droplet:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/droplet:latest
docker push --all-tags ccr.ccs.tencentyun.com/ossrs/droplet
#
docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_TAG
docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_VERSION
docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:v$SRS_MAJOR
docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_MAJOR
docker tag ossrs/lighthouse:$SRS_TAG ccr.ccs.tencentyun.com/ossrs/lighthouse:latest
docker push --all-tags ccr.ccs.tencentyun.com/ossrs/lighthouse
2022-01-17 06:13:42 +00:00
##################################################################################################################
##################################################################################################################
##################################################################################################################
# Create source tar for release
# Generate variables like:
# SRS_SOURCE_TAR=srs-server-4.0.145.tar.gz
# SRS_SOURCE_MD5=83e38700a80a26e30b2df054e69956e5
- name : Create source tar.gz
run : |
DEST_DIR=srs-server-$SRS_VERSION && mkdir -p $DEST_DIR &&
cp README.md $DEST_DIR && cp LICENSE $DEST_DIR && cp -R trunk $DEST_DIR/trunk &&
(cd $DEST_DIR/trunk/3rdparty && rm -rf *.zip openssl-*.gz srs-bench) &&
tar zcf ${DEST_DIR}.tar.gz ${DEST_DIR} && du -sh ${DEST_DIR}* && rm -rf ${DEST_DIR} &&
echo "SRS_SOURCE_TAR=${DEST_DIR}.tar.gz" >> $GITHUB_ENV &&
echo "SRS_SOURCE_MD5=$(md5sum ${DEST_DIR}.tar.gz| awk '{print $1}')" >> $GITHUB_ENV
# Create package tar for release
# Generate variables like:
# SRS_PACKAGE_ZIP=SRS-CentOS7-x86_64-4.0.145.zip
# SRS_PACKAGE_MD5=3880a26e30b283edf05700a4e69956e5
- name : Create package zip
env :
PACKAGER : ${{ secrets.SRS_PACKAGER_BINARY }}
run : |
docker build --tag srs:pkg --build-arg version=$SRS_VERSION --build-arg SRS_AUTO_PACKAGER=$PACKAGER -f trunk/Dockerfile.pkg . &&
SRS_PACKAGE_ZIP=SRS-CentOS7-x86_64-$SRS_VERSION.zip &&
docker run --rm -v $(pwd):/output srs:pkg cp objs/$SRS_PACKAGE_ZIP /output/ &&
du -sh $SRS_PACKAGE_ZIP &&
echo "SRS_PACKAGE_ZIP=$SRS_PACKAGE_ZIP" >> $GITHUB_ENV &&
echo "SRS_PACKAGE_MD5=$(md5sum $SRS_PACKAGE_ZIP| awk '{print $1}')" >> $GITHUB_ENV
2021-10-02 11:27:36 +00:00
# Create release.
- 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 }}
2021-10-03 06:34:23 +00:00
body : |
${{ github.event.head_commit.message }}
2021-11-15 02:55:47 +00:00
## Resource
* Source : ${{ env.SRS_SOURCE_MD5 }} [${{ env.SRS_SOURCE_TAR }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_SOURCE_TAR }})
* Binary : ${{ env.SRS_PACKAGE_MD5 }} [${{ env.SRS_PACKAGE_ZIP }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_PACKAGE_ZIP }})
## Docker
2022-01-03 00:55:42 +00:00
* China : [ docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:latest](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker)
2021-11-15 02:55:47 +00:00
* China : [ docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker)
* China : [ docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker)
2022-01-03 00:55:42 +00:00
* Global : [ docker pull ossrs/srs:latest](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker)
2021-11-15 02:55:47 +00:00
* Global : [ docker pull ossrs/srs:${{ env.SRS_MAJOR }}](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker)
* Global : [ docker pull ossrs/srs:${{ env.SRS_TAG }}](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker)
## Doc
* [ 快速入门](https://github.com/ossrs/srs/wiki/v4_CN_Home#getting-started) or [Getting Started](https://github.com/ossrs/srs/wiki/v4_EN_Home#getting-started)
* [ 中文Wiki首页](https://github.com/ossrs/srs/wiki/v4_CN_Home) or [Wiki home](https://github.com/ossrs/srs/wiki/v4_EN_Home)
* [ FAQ](https://github.com/ossrs/srs/issues/2716), [Features](https://github.com/ossrs/srs/blob/4.0release/trunk/doc/Features.md#features) or [ChangeLogs](https://github.com/ossrs/srs/blob/4.0release/trunk/doc/CHANGELOG.md#changelog)
2021-10-02 11:27:36 +00:00
draft : false
2021-12-19 08:49:43 +00:00
prerelease : false
2022-01-17 06:13:42 +00:00
2021-11-01 23:34:45 +00:00
# Upload release source files
- name : Upload Release Assets Source
id : upload-release-assets-source
2021-10-02 11:27:36 +00:00
uses : dwenegar/upload-release-assets@v1
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
with :
release_id : ${{ steps.create_release.outputs.id }}
assets_path : ${{ env.SRS_SOURCE_TAR }}
2022-01-17 06:13:42 +00:00
2021-11-01 23:34:45 +00:00
# Upload release package files
- name : Upload Release Assets Package
id : upload-release-assets-package
uses : dwenegar/upload-release-assets@v1
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
with :
release_id : ${{ steps.create_release.outputs.id }}
assets_path : ${{ env.SRS_PACKAGE_ZIP }}
2021-10-02 11:27:36 +00:00
2022-01-17 06:13:42 +00:00
##################################################################################################################
##################################################################################################################
##################################################################################################################
# K8S release to official website
- name : Setup KUBCONFIG for Aliyun ACK
run : |-
KUBECONFIG=$RUNNER_TEMP/kubeconfig_$(date +%s)
echo "${{ secrets.KUBCONFIG }}" > $KUBECONFIG
echo "KUBECONFIG=$KUBECONFIG" >> $GITHUB_ENV
# K8S for SRS 4.0
- name : Release SRS 4.0 to Aliyun ACK
if : ${{ startsWith(github.ref, 'refs/tags/v4') }}
run : |-
kubectl set image deploy/srs4-deploy srs4=registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
kubectl describe deploy/srs4-deploy