Skip to content

v1.1.31

v1.1.31 #222

Workflow file for this run

name: Deploy image to Docker
on:
push:
branches:
- master
- develop
- release/**
release:
types: [published]
jobs:
deploy-docker:
name: Build & Deploy image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- name: Prepare Variables
id: vars
shell: bash
run: |
REF=`echo ${GITHUB_REF} | cut -d "/" -f3-`
echo "REF=${REF}"
DOCKER_TAGS=$REF
DOCKER_FILE=Dockerfile-masterBranch
if [[ "${GITHUB_REF}" =~ refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+[a-z]* ]]; then
# GITHUB_REF matches refs/tags/v\d+.\d+.\d+ so its a release tag
PATCH_VERSION=${REF#v}
MINOR_VERSION=`echo ${PATCH_VERSION} | cut -f1,2 -d'.'`
MAJOR_VERSION=`echo ${MINOR_VERSION} | cut -f1 -d'.'`
DOCKER_TAGS="latest,${MAJOR_VERSION},${MINOR_VERSION},${PATCH_VERSION}"
elif [[ "${GITHUB_REF}" =~ refs\/heads\/release\/v.* ]]; then
# REF is a release branch so is a beta, qa or latest of this minor version
DOCKER_TAGS="latest-qa"
elif [[ "${GITHUB_REF}" =~ refs\/heads\/(master|develop) ]]; then
DOCKER_FILE="Dockerfile-${REF}Branch"
fi
echo "SETTING DOCKER_TAGS: ${DOCKER_TAGS}"
echo "DOCKER_TAGS=${DOCKER_TAGS}" >> $GITHUB_ENV
echo "docker_tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT
echo "SETTING DOCKER_FILE: ${DOCKER_FILE}"
echo "DOCKER_FILE=${DOCKER_FILE}" >> $GITHUB_ENV
echo "docker_file=${DOCKER_FILE}" >> $GITHUB_OUTPUT
- name: Debug
shell: bash
run: |
echo "GITHUB_REF: " ${GITHUB_REF}
echo "DOCKER_TAGS: " ${{ env.DOCKER_TAGS }}
echo "DOCKER_FILE: " ${{ env.DOCKER_FILE }}
echo "steps.vars.outputs.docker_tags:" ${{ steps.vars.outputs.docker_tags }}
echo "steps.vars.outputs.docker_file:" ${{ steps.vars.outputs.docker_file }}
- name: Publish Docker Github Action
uses: elgohr/Publish-Docker-Github-Action@master
with:
workdir: .
name: unfoldingword/tx_job_handler
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
dockerfile: ${{ steps.vars.outputs.docker_file }}
tags: ${{ steps.vars.outputs.docker_tags }}