Skip to content

Commit

Permalink
Auto relese docker
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 14, 2021
1 parent 1b5b7f3 commit 283ab7f
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Release"

on:
push:
tags:
- v1*

jobs:
docker:
name: release-docker
runs-on: ubuntu-20.04

steps:
################################################################
# Git checkout
- name: Checkout repository
uses: actions/checkout@v2

################################################################
# Build
# The github.ref is, for example, refs/tags/v1.0.52
# Generate variables like:
# SRS_TAG=v1.0.52
# SRS_MAJOR=1
# @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_MAJOR=$(echo $SRS_TAG| cut -c 2)
echo "SRS_MAJOR=$SRS_MAJOR" >> $GITHUB_ENV
# Build SRS image
- name: Build SRS docker image
run: |
echo "Release ossrs/signaling:$SRS_TAG"
docker build --tag ossrs/signaling:$SRS_TAG .
################################################################
# Aliyun ACR
- name: Login Aliyun docker hub
uses: aliyun/acr-login@v1
with:
login-server: https://registry.cn-hangzhou.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- name: Push to Aliyun docker hub
run: |
docker tag ossrs/signaling:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/signaling:$SRS_TAG
docker tag ossrs/signaling:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/signaling:$SRS_MAJOR
docker push --all-tags registry.cn-hangzhou.aliyuncs.com/ossrs/signaling
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/signaling.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ docker run --rm --env CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2
Run signaling in docker:

```bash
docker run --rm -p 1989:1989 registry.cn-hangzhou.aliyuncs.com/ossrs/signaling:v1.0.4
docker run --rm -p 1989:1989 registry.cn-hangzhou.aliyuncs.com/ossrs/signaling:1
```

> Note: More images and version is [here](https://cr.console.aliyun.com/repository/cn-hangzhou/ossrs/signaling/images).
Expand Down
16 changes: 16 additions & 0 deletions auto/pub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

RELEASE=$(git describe --tags --abbrev=0 --exclude release-*)
REVISION=$(echo $RELEASE|awk -F . '{print $3}')
let NEXT=$REVISION+1
echo "Last release is $RELEASE, revision is $REVISION, next is $NEXT"

TAG="v1.0.$NEXT"
echo "publish $TAG"

git push
git tag -d $TAG 2>/dev/null && git push origin :$TAG
git tag $TAG
git push origin $TAG
echo "publish $TAG ok"
echo " https://github.com/ossrs/signaling/actions"
3 changes: 3 additions & 0 deletions auto/release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

echo "Please use: ./auto/pub.sh"
exit 1;

SRS_GIT=$HOME/git/signaling
SRS_TAG=

Expand Down

0 comments on commit 283ab7f

Please sign in to comment.