Skip to content

Workflow file for this run

# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure Functions: https://aka.ms/python-webapps-actions
name: Build and push images to Docker Hub
on:
release:
types:
- released
- prereleased
jobs:
deploy_to_dockerhub:
# Use a matrix to run for "controller", "status", and "usage" functions
# https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
matrix:
function: [controller, usage, status]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get release tag
id: current_release
run: |
CURRENT_RELEASE=${{ github.event.release.tag_name }}
echo "CURRENT_RELEASE=${CURRENT_RELEASE}" >> $GITHUB_ENV
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_RELEASE"
MAJOR_VERSION_NUMBER="${VERSION_PARTS[0]}"
echo "MAJOR_VERSION_NUMBER=${MAJOR_VERSION_NUMBER}" >> $GITHUB_ENV
echo "The current release is $CURRENT_RELEASE"
echo "The current major version number is $MAJOR_VERSION_NUMBER"
- name: Set pre-release suffix
if: ${{ github.event.release.prerelease }}
run: |
echo "TAG_SUFFIX=prerelease" >> $GITHUB_ENV
- name: Set release suffix
if: ${{ !github.event.release.prerelease }}
run: |
echo "TAG_SUFFIX=latest" >> $GITHUB_ENV
- name: Login to Docker Hub
id: docker_login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push function
run: |
docker build ${{ matrix.function }}_function -t turingrc/rctab-${{ matrix.function }}:${{ env.CURRENT_RELEASE }} -t turingrc/rctab-${{ matrix.function }}:${{ env.MAJOR_VERSION_NUMBER }}.${{ env.TAG_SUFFIX }}
docker push --all-tags turingrc/rctab-${{ matrix.function }}