Skip to content

Commit

Permalink
add block to fetch tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rikukissa committed Feb 9, 2024
1 parent b7d89d2 commit f3be2b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit f3be2b3

Please sign in to comment.