Skip to content

Update Auto cherry-pick pipeline as per core PR #134

Update Auto cherry-pick pipeline as per core PR

Update Auto cherry-pick pipeline as per core PR #134

name: Publish image to Dockerhub
on:
push:
branches:
- master
- develop
- main
workflow_dispatch:
inputs:
branch_name:
description: Branch to build from
default: develop
required: true
jobs:
push:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
fetch-depth: 2
ref: '${{ github.event.inputs.branch_name }}'
- uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Get tags
run: git fetch --tags origin
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image
env:
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }}
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }}
run: |
# Check if the current commit has a tag and use it; otherwise, use the short SHA of the HEAD commit
export COUNTRY_CONFIG_VERSION=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short=7 HEAD)
echo "Publishing a Docker image with a tag $COUNTRY_CONFIG_VERSION"
bash build-and-push.sh && unset COUNTRY_CONFIG_VERSION