make-release.sh: Add support for `--no-checkout`

This commit is contained in:
Johannes Meyer 2021-07-20 10:44:01 +02:00
parent 86924957f4
commit 2a83df30a7
1 changed files with 10 additions and 5 deletions

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
VERSION="$1" VERSION="$1"
NO_TAG="$2" NO_OPT="$2"
if [[ -z $VERSION ]]; then if [[ -z $VERSION ]]; then
echo "USAGE: $0 <version>" echo "USAGE: $0 <version> [--no-tag|--no-checkout]"
echo " e.g.: $0 0.1.0" echo " e.g.: $0 0.1.0"
exit 1 exit 1
fi fi
@ -23,8 +23,13 @@ if [[ "$TAG" -ne "0" ]]; then
exit 1 exit 1
fi fi
if [ "$NO_OPT" != "--no-checkout" ]; then
BRANCH="stable/$VERSION" BRANCH="stable/$VERSION"
git checkout -b "$BRANCH" || fail "Version branch $BRANCH already exists" git checkout -b "$BRANCH" || fail "Version branch $BRANCH already exists"
else
BRANCH=$(git rev-parse --abbrev-ref HEAD)
fi
git rm -rf vendor git rm -rf vendor
rm -rf vendor rm -rf vendor
rm -f composer.lock rm -f composer.lock
@ -46,7 +51,7 @@ rm -rf vendor
git checkout vendor git checkout vendor
composer validate --no-check-all --strict || fail "Composer validate failed" composer validate --no-check-all --strict || fail "Composer validate failed"
if [ "$NO_TAG" != "--no-tag" ]; then if [ -z "$NO_OPT" ]; then
git tag -a v$VERSION -m "Version v$VERSION" git tag -a v$VERSION -m "Version v$VERSION"
echo "Finished, tagged v$VERSION" echo "Finished, tagged v$VERSION"
echo "Now please run:" echo "Now please run:"