Skip to content

Commit

Permalink
workflow: update docker action for tag trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Jan 27, 2021
1 parent e5fb059 commit e275bd6
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: docker
on:
push:
branches: master
tags: "*"

jobs:
docker:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
Expand All @@ -25,21 +26,32 @@ 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:
context: .
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:
context: .
file: ./Dockerfile.alpine
platforms: linux/amd64,linux/arm64
push: true
tags: |
tsl0922/ttyd:alpine
tags: ${{ steps.docker_tag.outputs.ALPINE_TAG }}

0 comments on commit e275bd6

Please sign in to comment.