Update release workflow to use jq for JSON parsing of latest GitHub release version, ensuring reliable extraction and handling of null values.

This commit is contained in:
Luke Hagar
2025-09-26 17:42:14 +00:00
parent f3743a01f1
commit 9816484b6d

View File

@@ -62,15 +62,15 @@ jobs:
id: version-check
shell: bash
run: |
# Get the latest GitHub release version
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8')).tag_name" 2>/dev/null || echo "")
# Get the latest GitHub release version using jq for reliable JSON parsing
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name // empty' 2>/dev/null || echo "")
CURRENT_VERSION="${{ steps.current-version.outputs.version }}"
echo "Latest release: $LATEST_RELEASE"
echo "Current version: $CURRENT_VERSION"
# Remove 'v' prefix from release tag for comparison
if [ -n "$LATEST_RELEASE" ]; then
if [ -n "$LATEST_RELEASE" ] && [ "$LATEST_RELEASE" != "null" ]; then
LATEST_VERSION=$(echo "$LATEST_RELEASE" | sed 's/^v//')
else
LATEST_VERSION="0.0.0"