You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
srs/.github/workflows/release.yml

272 lines
15 KiB
YAML

name: "Release"
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
on:
push:
tags:
- v5*
jobs:
k8s:
name: release-k8s
runs-on: ubuntu-20.04
steps:
##################################################################################################################
##################################################################################################################
##################################################################################################################
# Git checkout
- name: Checkout repository
uses: actions/checkout@v2
# 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
# SRS_VERSION=5.0.145
# SRS_VERSION=5.0-r8
# 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}')
echo "SRS_TAG=$SRS_TAG" >> $GITHUB_ENV
SRS_VERSION=$(echo ${SRS_TAG}| sed 's/^v//g')
echo "SRS_VERSION=$SRS_VERSION" >> $GITHUB_ENV
SRS_MAJOR=$(echo $SRS_TAG| cut -c 2)
echo "SRS_MAJOR=$SRS_MAJOR" >> $GITHUB_ENV
# Tests
- name: Build test image
run: docker build --tag srs:test -f trunk/Dockerfile.test .
# For utest
- name: Run SRS utest
run: docker run --rm srs:test bash -c 'make utest && ./objs/srs_utest'
# 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'
##################################################################################################################
##################################################################################################################
##################################################################################################################
# Build SRS docker images
- name: Build SRS docker image
env:
PACKAGER: ${{ secrets.SRS_PACKAGER_DOCKER }}
PACKAGER_DROPLET: ${{ secrets.SRS_PACKAGER_DROPLET }}
PACKAGER_LIGHTHOUSE: ${{ secrets.SRS_PACKAGER_LIGHTHOUSE }}
run: |
echo "Release ossrs/srs:$SRS_TAG"
docker build --tag ossrs/srs:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER -f trunk/Dockerfile .
echo "Release ossrs/droplet:$SRS_TAG"
docker build --tag ossrs/droplet:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER_DROPLET -f trunk/Dockerfile .
echo "Release ossrs/lighthouse:$SRS_TAG"
docker build --tag ossrs/lighthouse:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER_LIGHTHOUSE -f trunk/Dockerfile .
# Docker hub
# TODO: FIXME: If stable, please set the latest from 4.0 to 5.0
- 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
#docker tag ossrs/srs:$SRS_TAG ossrs/srs:latest
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
#
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
# Aliyun ACR hub
# TODO: FIXME: If stable, please set the latest from 4.0 to 5.0
- name: Login Aliyun docker 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 docker hub
run: |
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_VERSION
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:v$SRS_MAJOR
docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_MAJOR
#docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:latest
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
#
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
# Tencent TCR Singapore hub
# TODO: FIXME: If stable, please set the latest from 4.0 to 5.0
- name: Login Tencent Singapore docker hub
uses: docker/login-action@v1
with:
registry: sgccr.ccs.tencentyun.com
username: "${{ secrets.TCR_USERNAME }}"
password: "${{ secrets.TCR_PASSWORD }}"
- name: Push to Tencent Singapore docker hub
run: |
docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:$SRS_TAG
docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:$SRS_VERSION
docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:v$SRS_MAJOR
docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:$SRS_MAJOR
#docker tag ossrs/srs:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/srs:latest
docker push --all-tags sgccr.ccs.tencentyun.com/ossrs/srs
#
docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:$SRS_TAG
docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:$SRS_VERSION
docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:v$SRS_MAJOR
docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:$SRS_MAJOR
#docker tag ossrs/droplet:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/droplet:latest
docker push --all-tags sgccr.ccs.tencentyun.com/ossrs/droplet
#
docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_TAG
docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_VERSION
docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:v$SRS_MAJOR
docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:$SRS_MAJOR
#docker tag ossrs/lighthouse:$SRS_TAG sgccr.ccs.tencentyun.com/ossrs/lighthouse:latest
docker push --all-tags sgccr.ccs.tencentyun.com/ossrs/lighthouse
# Tencent TCR Beijing hub
# TODO: FIXME: If stable, please set the latest from 4.0 to 5.0
- name: Login Tencent Beijing docker hub
uses: docker/login-action@v1
with:
registry: ccr.ccs.tencentyun.com
username: "${{ secrets.TCR_USERNAME }}"
password: "${{ secrets.TCR_PASSWORD }}"
- name: Push to Tencent Beijing 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
##################################################################################################################
##################################################################################################################
##################################################################################################################
# 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_SOURCE_TAR=srs-server-5.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-5.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
# Create release.
# TODO: FIXME: Refine the release when 5.0 releoased
- 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 }}
body: |
[${{ github.event.head_commit.message }}](https://github.com/ossrs/srs/commit/${{ github.sha }})
## 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
* China: docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}
* China: docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}
* Global: docker pull ossrs/srs:${{ env.SRS_MAJOR }}
* Global: docker pull ossrs/srs:${{ env.SRS_TAG }}
## Doc
* [FAQ](https://github.com/ossrs/srs/issues/2716), [Features](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/Features.md#features) or [ChangeLogs](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/CHANGELOG.md#changelog)
draft: false
prerelease: true
# 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: ${{ steps.create_release.outputs.id }}
assets_path: ${{ env.SRS_SOURCE_TAR }}
# 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 }}
##################################################################################################################
##################################################################################################################
##################################################################################################################
# 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 5.0
- name: Release SRS 5.0 to Aliyun ACK
if: ${{ startsWith(github.ref, 'refs/tags/v5') }}
run: |-
kubectl set image deploy/srs5-deploy srs=registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_TAG
kubectl describe deploy/srs5-deploy