Skip to content

Commit eef4ed6

Browse files
authored
OBI generator image: some extra fixes to the image automatic numbering (#250)
1 parent 73eb615 commit eef4ed6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/generator-image.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,17 @@ jobs:
5454
OVERRIDE_IMG_TAG: ${{ github.event.inputs.override_image_tag }}
5555
run: |
5656
if [[ "$OVERRIDE_IMG_TAG" == "" ]]; then
57-
echo "Fetching latest version from $${{ env.REGISTRY }}/{{ env.IMAGE }}..."
57+
echo "Fetching latest version from ${{ env.REGISTRY }}/${{ env.IMAGE }}..."
5858
5959
# Get authentication token for GHCR
6060
TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64)
6161
6262
# Fetch tags from GHCR API
63-
LATEST_VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
64-
"https://${{ env.REGISTRY }}/v2/${{ env.IMAGE }}/tags/list" | \
63+
TAGS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
64+
"https://${{ env.REGISTRY }}/v2/${{ env.IMAGE }}/tags/list")
65+
echo "Image tags: ${TAGS}"
66+
67+
LATEST_VERSION=$(echo "${TAGS}" | \
6568
jq -r '.tags[]' | \
6669
grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | \
6770
sort -V | \
@@ -76,7 +79,7 @@ jobs:
7679
IFS='.' read -r major minor patch <<< "$LATEST_VERSION"
7780
# Increment minor version
7881
NEW_PATCH=$((patch + 1))
79-
NEW_VERSION="${major}.${minor}.0"
82+
NEW_VERSION="${major}.${minor}.${NEW_PATCH}"
8083
fi
8184
8285
echo "New version: $NEW_VERSION"

0 commit comments

Comments
 (0)