Skip to content

Commit

Permalink
fix(ci): rework get latest tag for build Docker image (#954)
Browse files Browse the repository at this point in the history
* fix getting tag when building container

* add debug informations

* fix debug output
  • Loading branch information
dklimpel authored Aug 1, 2024
1 parent 5cb881b commit 1215fce
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/docker-goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@ jobs:
ghcr.io/${{ github.repository_owner }}/goss
- name: Get latest git tag
uses: actions-ecosystem/action-get-latest-tag@v1
if: github.ref_name == 'master'
id: get-latest-tag
run: |
# source: https://github.com/actions-ecosystem/action-get-latest-tag/blob/main/entrypoint.sh
set -e
git config --global --add safe.directory /github/workspace
git fetch --tags --force
# This suppress an error occurred when the repository is a complete one.
git fetch --prune --unshallow 2>/dev/null || true
latest_tag=$(git describe --abbrev=0 --tags || true)
echo "tag=${latest_tag}" >> "$GITHUB_OUTPUT"
echo "Latest tag: $latest_tag"
- name: Set short git commit SHA
if: github.ref_name == 'master'
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
echo "COMMIT_SHORT_SHA: $calculatedSha"
- name: Get the current version of Go from project.
run: echo "GO_VERSION_FROM_PROJECT=$(go mod edit -json | jq -r .Go)" >> $GITHUB_ENV
Expand Down

0 comments on commit 1215fce

Please sign in to comment.