Created
December 7, 2021 07:33
-
-
Save lauer/d7345fab533f611730a4087338032c2a to your computer and use it in GitHub Desktop.
Small script to jenkinsfile which set the last .0 on alpha releases to the $BUILD_NUMBER from jenkins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [[ -z "${BUILD_NUMBER}" ]]; then | |
echo "No build number set" | |
env | |
exit 0 | |
fi | |
BUILD_VERSION=`jq -r '.version' package.json | sed "s/0$/${BUILD_NUMBER}/"` | |
if [[ $BUILD_VERSION =~ .*alpha.* ]]; then | |
tmp=$(mktemp) | |
jq '.version="'"$BUILD_VERSION"'"' package.json > "${tmp}" && mv "${tmp}" package.json | |
else | |
echo "${BUILD_VERSION} does not contains alpha" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment