diff --git a/.github/workflows/publish-to-dockerhub.yml b/.github/workflows/publish-to-dockerhub.yml index 650fa95e1..425ea8bfa 100644 --- a/.github/workflows/publish-to-dockerhub.yml +++ b/.github/workflows/publish-to-dockerhub.yml @@ -25,6 +25,9 @@ jobs: - uses: actions/checkout@v2 if: github.event_name == 'push' + - name: Get tags + run: git fetch --tags origin + - name: Login to DockerHub uses: docker/login-action@v1 with: @@ -36,6 +39,6 @@ jobs: 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 - COUNTRY_CONFIG_VERSION=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short=7 HEAD) + 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