Skip to content

Merge pull request #212 from yejin-fxn/master #9

Merge pull request #212 from yejin-fxn/master

Merge pull request #212 from yejin-fxn/master #9

name: Docker build and push
on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
jobs:
# no test is required
push:
runs-on: ubuntu-18.04
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Prepare the TAG
id: prepare-the-tag
run: |
# strip git ref prefix from version
TAG=""
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
if [ $VERSION = "master" ]; then
TAG=latest
else
TAG=${VERSION##*v}-release
fi
echo "::notice col=5 title=print tag::TAG=$TAG"
echo "::set-output name=tag::$TAG"
- name: Build image
run: TAG=${{steps.prepare-the-tag.outputs.tag}} bash docker-build/build_cluster_docker.sh all
- name: Log into DockerHub
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
run: TAG=${{steps.prepare-the-tag.outputs.tag}} bash docker-build/build_cluster_docker.sh push