feat: improve wizard
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>pull/726/head
parent
997f21fc55
commit
cba41a1a32
43
wizard.sh
43
wizard.sh
|
@ -20,7 +20,7 @@ updateVersion () {
|
||||||
from=$1
|
from=$1
|
||||||
to=$2
|
to=$2
|
||||||
|
|
||||||
echo "Updating version from \"$from\" to \"$to\""
|
echo "🎁 Updating version from \"$from\" to \"$to\""
|
||||||
sed -i.bak "s|$from|$to|g" $REPO/version/version.go
|
sed -i.bak "s|$from|$to|g" $REPO/version/version.go
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,56 +52,47 @@ buildBinary () {
|
||||||
release () {
|
release () {
|
||||||
cd $REPO
|
cd $REPO
|
||||||
|
|
||||||
echo "> Checking semver format"
|
echo "👀 Checking semver format"
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
echo "This release script requires a single argument corresponding to the semver to be released. See semver.org"
|
echo "❌ This release script requires a single argument corresponding to the semver to be released. See semver.org"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
semver=$(echo "$1" | grep -P '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)')
|
GREP="grep"
|
||||||
|
if [ -x "$(command -v ggrep)" ]; then
|
||||||
|
GREP="ggrep"
|
||||||
|
fi
|
||||||
|
|
||||||
|
semver=$(echo "$1" | $GREP -P '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)')
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Not valid semver format. See semver.org"
|
echo "❌ Not valid semver format. See semver.org"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "> Checking matching $semver in frontend submodule"
|
echo "🐑 Fetching 'master' on 'frontend' and creating new tag"
|
||||||
|
|
||||||
cd frontend
|
cd frontend
|
||||||
git fetch --all
|
git fetch --all
|
||||||
|
git checkout master
|
||||||
if [ $(git tag | grep "$semver" | wc -l) -eq 0 ]; then
|
git tag $semver
|
||||||
echo "Tag $semver does not exist in submodule 'frontend'. Tag it and run this script again."
|
git push --tags
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
git rev-parse --verify --quiet release
|
|
||||||
exitcode=$?
|
|
||||||
set -e
|
|
||||||
if [ $exitcode -ne 0 ]; then
|
|
||||||
git checkout -b release "$semver"
|
|
||||||
else
|
|
||||||
git checkout release
|
|
||||||
git reset --hard "$semver"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
echo "> Updating submodule ref to $semver"
|
echo "🐑 Updating submodule ref to $semver"
|
||||||
updateVersion $untracked $1
|
updateVersion $untracked $1
|
||||||
git commit -am "chore: version $semver"
|
git commit -am "chore: version $semver"
|
||||||
git tag "$1"
|
git tag "$1"
|
||||||
git push
|
|
||||||
git push --tags
|
git push --tags
|
||||||
|
|
||||||
echo "> Commiting untracked version notice..."
|
echo "🐑 Commiting untracked version notice..."
|
||||||
updateVersion $1 $untracked
|
updateVersion $1 $untracked
|
||||||
git commit -am "chore: setting untracked version [ci skip]"
|
git commit -am "chore: setting untracked version [ci skip]"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
echo "> Done!"
|
echo "📦 Done! $semver released."
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
|
Loading…
Reference in New Issue