Update cache #312
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/tag-push-action@v2.0.0 | |
with: | |
src: ossrs/srs:${{ env.SRS_TAG }} | |
dst: | | |
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }} | |