Skip to content

Fix docker bug.

Fix docker bug. #369

Workflow file for this run

name: "Release"
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
on:
push:
branches:
- 'ubuntu18'
jobs:
docker:
name: release-docker
runs-on: ubuntu-20.04
steps:
################################################################
# Git checkout
- name: Checkout repository
uses: actions/checkout@v3
################################################################
# Build
# The github.ref is, for example, refs/tags/dev @see https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
# Generate variables like:
# SRS_TAG=dev
# @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
echo "SRS_TAG_DATE=${{ needs.envs.outputs.SRS_TAG }}-$(date +%y-%m-%d)" >> $GITHUB_ENV
# Build SRS image
- name: Build SRS docker image
run: |
echo "Release ossrs/srs:$SRS_TAG"
docker build --tag ossrs/srs:$SRS_TAG .
################################################################
# Docker
- name: Login docker hub
uses: docker/login-action@v2
with:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Push to docker hub
run: |
docker push ossrs/srs:$SRS_TAG
- name: Copy to docker registry
uses: akhilerm/[email protected]
with:
src: ossrs/srs:${{ env.SRS_TAG }}
dst: |
ossrs/srs:${{ env.SRS_TAG_DATE }}
################################################################
- name: Login aliyun hub
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- name: Copy to Aliyun registry
uses: akhilerm/[email protected]
with:
src: ossrs/srs:${{ env.SRS_TAG }}
dst: |
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG_DATE }}