diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 2f867ade..cc08221a 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -641,7 +641,7 @@ jobs: VERSION: ${{ needs.prepare.outputs.version }} run: | cp sc.sh .sc/stacks/dist/bundle/sc.sh - sed -i -e 's/VERSION="0\.0\.0"/VERSION="${VERSION}"/g' .sc/stacks/dist/bundle/sc.sh + sed -i -e "s/VERSION=\"0\\.0\\.0\"/VERSION=\"${VERSION}\"/" .sc/stacks/dist/bundle/sc.sh echo "${VERSION}" > .sc/stacks/dist/bundle/version # Sign the post-template sc.sh that will land on dist.simple-container.com. # Signing the *post-sed* artifact is intentional: consumers verify the diff --git a/sc.sh b/sc.sh index 17aff144..9686cad0 100755 --- a/sc.sh +++ b/sc.sh @@ -62,6 +62,16 @@ compareNumber() { printf "%s" "0" return fi + # Guard: empty first arg means second is "greater" (newer) + if [ -z "$1" ]; then + printf "%s" "-1" + return + fi + # Guard: empty second arg means first is "greater" + if [ -z "$2" ]; then + printf "%s" "1" + return + fi [ $(($2 - $1)) -gt 0 ] && printf "%s" "-1" [ $(($2 - $1)) -lt 0 ] && printf "1" @@ -708,7 +718,7 @@ FORCE_UPDATE="true" fi VERSION_COMPARE="1" -if [[ "$CURRENT" != "null" ]]; then +if [[ "$CURRENT" != "null" && -n "$VERSION" ]]; then VERSION_COMPARE="$(semver_compare "$VERSION" "$CURRENT" || echo "1")" fi