Skip to content

Build and Push [DockerHub] #5

Build and Push [DockerHub]

Build and Push [DockerHub] #5

Workflow file for this run

name: Build and Publish
on:
push:
tags:
- '*'
env:
IMAGE: flow-pubsub
jobs:
setup-build-publish:
name: Setup, Build and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
# Setup project version
- name: Get version
id: version
run: |
VERSION="dev"
if [[ "${GITHUB_REF/refs\/tags\//}" != "refs/heads/"* ]] ; then
VERSION="${GITHUB_REF/refs\/tags\//}"
fi
echo ::set-output name=VERSION::${VERSION}
# Build the Docker image
- name: Build
run: |
VERSION=${{ steps.version.outputs.VERSION }}
DOCKER_VER=${VERSION#"v"}
docker build \
-t flowlab/"$IMAGE":latest \
-t flowlab/"$IMAGE":"$DOCKER_VER" .
- name: Setup DockerHub
run: |
docker login --username flowlab --password ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish DockerHub
run: |
docker push flowlab/$IMAGE