summaryrefslogtreecommitdiffstats
path: root/bin/make-release.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:38:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:38:42 +0000
commitc3ca98e1b35123f226c7f4c596b5dee78caa4223 (patch)
tree9b6eb109283da55e7d9064baa9fac795a40264cb /bin/make-release.sh
parentInitial commit. (diff)
downloadicinga-php-thirdparty-c3ca98e1b35123f226c7f4c596b5dee78caa4223.tar.xz
icinga-php-thirdparty-c3ca98e1b35123f226c7f4c596b5dee78caa4223.zip
Adding upstream version 0.11.0.upstream/0.11.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xbin/make-release.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/bin/make-release.sh b/bin/make-release.sh
new file mode 100755
index 0000000..4c603e7
--- /dev/null
+++ b/bin/make-release.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+VERSION="$1"
+NO_OPT="$2"
+
+if [[ -z $VERSION ]]; then
+ echo "USAGE: $0 <version> [--no-tag|--no-checkout]"
+ echo " e.g.: $0 0.1.0"
+ exit 1
+fi
+
+function fail {
+ local msg="$1"
+ echo "ERROR: $msg"
+ exit 1
+}
+
+TAG=$(git tag | grep -c "$VERSION")
+
+if [[ "$TAG" -ne "0" ]]; then
+ echo -n "Version $VERSION has already been tagged: "
+ git tag | grep "$VERSION"
+ exit 1
+fi
+
+if [ "$NO_OPT" != "--no-checkout" ]; then
+ BRANCH="stable/$VERSION"
+ git checkout -b "$BRANCH" || fail "Version branch $BRANCH already exists"
+else
+ BRANCH=$(git rev-parse --abbrev-ref HEAD)
+fi
+
+git rm -rf vendor
+rm -rf vendor
+rm -f composer.lock
+composer install || fail "composer install failed"
+find vendor/ -type f -name "*.php" \
+ | grep -v '/examples/' \
+ | grep -v '/example/' \
+ | grep -v '/tests/' \
+ | grep -v '/test/' \
+ | xargs -L1 git add -f
+find vendor/ -type f -name LICENSE | xargs -L1 git add -f
+find vendor/ -type f -name '*.json' | xargs -L1 git add -f
+find asset/ -type f | xargs -L1 git add -f
+echo "v$VERSION" > VERSION
+git add VERSION
+git add composer.lock -f
+git commit -m "Version v$VERSION"
+
+rm -rf vendor
+git checkout vendor
+composer validate --no-check-all --strict || fail "Composer validate failed"
+
+if [ -z "$NO_OPT" ]; then
+ git tag -a v$VERSION -m "Version v$VERSION"
+ echo "Finished, tagged v$VERSION"
+ echo "Now please run:"
+else
+ echo "Finished, but not tagged yet"
+ echo "Now please run:"
+ echo "git tag -s v$VERSION -m \"Version v$VERSION\""
+fi
+
+echo "git push origin "$BRANCH":"$BRANCH" && git push --tags"