Skip to content

Commit

Permalink
Even better way to get latest and previous tag from current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MukuFlash03 committed Oct 7, 2024
1 parent 451c730 commit 92efb73
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/reusable_image_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
echo "SERVER_IMAGE_TAG=$SERVER_IMAGE_TAG" >> "$GITHUB_OUTPUT"
EOF
: << EOF2
response=$(curl -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_FG_PAT_TAGS }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
Expand All @@ -65,12 +66,23 @@ jobs:
tags=$(echo "$response" | jq -r '.[].ref' | cut -d'/' -f3)
latest_tag=$(echo "$tags" | sort -V | tail -n 1)
previous_tag=$(echo "$tags" | sort -V | tail -n 2 | head -n 1)
echo "SERVER_IMAGE_TAG=$latest_tag" >> "$GITHUB_OUTPUT"
echo "PREVIOUS_SERVER_TAG=$previous_tag" >> "$GITHUB_OUTPUT"
EOF2
SECOND_LATEST_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))
echo "Second latest tag: $SECOND_LATEST_TAG"
latest_tag=$(git describe --abbrev=0 --tags)
previous_tag=$(git describe --abbrev=0 --tags --exclude="$(git describe --abbrev=0 --tags))
echo "SERVER_IMAGE_TAG=$latest_tag" >> "$GITHUB_OUTPUT"
echo "PREVIOUS_SERVER_TAG=$previous_tag" >> "$GITHUB_OUTPUT"
echo "Latest server tag: $latest_tag"
echo "Previous server tag: $previous_tag"
# SECOND_LATEST_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))
# echo "Second latest tag: $SECOND_LATEST_TAG"
- name: Bump up release tag
# if: ${{ inputs.repo == 'op-admin-dashboard' || inputs.repo == 'em-public-dashboard' }}
Expand Down

0 comments on commit 92efb73

Please sign in to comment.