Skip to content

Commit 5b880ef

Browse files
committed
Update containerlab version retrieval to follow redirect for latest release
1 parent d40209e commit 5b880ef

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/build-wsl-image.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ jobs:
2929
- name: Get latest containerlab version
3030
id: containerlab
3131
run: |
32-
# Fetch the latest release information from containerlab repository
33-
CONTAINERLAB_LATEST=$(curl -s https://api.github.com/repos/srl-labs/containerlab/releases/latest | jq -r .tag_name)
34-
echo "CONTAINERLAB_VERSION=${CONTAINERLAB_LATEST#v}" >> $GITHUB_OUTPUT
35-
echo "Latest containerlab version: ${CONTAINERLAB_LATEST#v}"
32+
# Get latest version by following the redirect to the latest release
33+
LATEST_URL=$(curl -sLI -o /dev/null -w '%{url_effective}' https://github.com/srl-labs/containerlab/releases/latest)
34+
echo "Latest release URL: $LATEST_URL"
35+
36+
# Extract version from URL
37+
CONTAINERLAB_LATEST=$(echo $LATEST_URL | rev | cut -d'/' -f1 | rev)
38+
39+
# Remove the 'v' prefix
40+
CONTAINERLAB_VERSION=${CONTAINERLAB_LATEST#v}
41+
echo "CONTAINERLAB_VERSION=$CONTAINERLAB_VERSION" >> $GITHUB_OUTPUT
42+
echo "Latest containerlab version: $CONTAINERLAB_VERSION"
3643
3744
- name: Get latest WSL release version
3845
id: current_release

0 commit comments

Comments
 (0)