Skip to content

Formatting corrected in documentation #33

Formatting corrected in documentation

Formatting corrected in documentation #33

Workflow file for this run

name: Build and Publish Docker
on:
push:
branches:
- develop
- main
jobs:
build-and-publish-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Read docker name
id: yaml-docker-name
uses: jbutcher5/read-yaml@main
with:
file: 'build.yml'
key-path: '["docker_image_name"]'
- name: Read docker version
id: yaml-docker-version
uses: jbutcher5/read-yaml@main
with:
file: 'build.yml'
key-path: '["docker_image_version"]'
- name: Generate docker tag
env:
GITHUB_BRANCH: ${{ github.ref }}
docker_image_name: ${{ steps.yaml-docker-name.outputs.data }}
docker_image_version: ${{ steps.yaml-docker-version.outputs.data }}
run: |
branch_name=${GITHUB_BRANCH#refs/heads/}
echo "branch_name=${GITHUB_BRANCH#refs/heads/}" >> $GITHUB_ENV
if [[ "$branch_name" = "main" ]]
then
mType=""
else
mType="dev"
fi
echo "docker_tag=$docker_image_name:$mType$docker_image_version" >> $GITHUB_ENV
echo "docker_tag_latest=$docker_image_name:${mType}latest" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
no-cache: true
tags: |
${{ env.docker_tag }}
${{ env.docker_tag_latest }}