From: Shuanglei Tao Date: Wed, 27 Jan 2021 17:48:29 +0000 (+0800) Subject: workflow: update docker action for tag trigger X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=e275bd6bf30598886a3e6a1426b49d97791a2759;p=ttyd.git workflow: update docker action for tag trigger --- diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0cb3b7e..312d7ed 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,9 +3,10 @@ name: docker on: push: branches: master + tags: "*" jobs: - docker: + build: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -25,6 +26,19 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_TOKEN }} + - name: Determine docker tags + id: docker_tag + run: | + case $GITHUB_REF in + refs/tags/*) + TAG_NAME=${GITHUB_REF#refs/tags/} + echo ::set-output name=DOCKER_TAG::tsl0922/ttyd:${TAG_NAME} + echo ::set-output name=ALPINE_TAG::tsl0922/ttyd:${TAG_NAME}-alpine + ;; + *) + echo ::set-output name=DOCKER_TAG::tsl0922/ttyd:latest + echo ::set-output name=ALPINE_TAG::tsl0922/ttyd:alpine + esac - name: build/push docker image uses: docker/build-push-action@v2 with: @@ -32,8 +46,7 @@ jobs: file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: | - tsl0922/ttyd:latest + tags: ${{ steps.docker_tag.outputs.DOCKER_TAG }} - name: build/push docker image (alpine) uses: docker/build-push-action@v2 with: @@ -41,5 +54,4 @@ jobs: file: ./Dockerfile.alpine platforms: linux/amd64,linux/arm64 push: true - tags: | - tsl0922/ttyd:alpine \ No newline at end of file + tags: ${{ steps.docker_tag.outputs.ALPINE_TAG }}