summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-03 15:38:41 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-03 20:06:46 +0200
commit924c5434307a0f69068b8c2c6acf25450fff4ae8 (patch)
tree5955545e7d82852d4ab32dc7ee2c9c078593aadd /tools
parent1c3b871204072b612ea3793708b508fc4de923be (diff)
downloadweechat-924c5434307a0f69068b8c2c6acf25450fff4ae8.zip
core: ensure tag/commit are not done upon startup, do not undo tag/commit in case of error
Diffstat (limited to 'tools')
-rwxr-xr-xtools/release.sh23
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/release.sh b/tools/release.sh
index 2adbf8258..09747a483 100755
--- a/tools/release.sh
+++ b/tools/release.sh
@@ -28,24 +28,27 @@
set -o errexit
-unset VERSION
-unset GIT_COMMIT_RC
-unset GIT_TAG_RC
-
release_error ()
{
[ $# -gt 0 ] && echo >&2 "ERROR: $*"
- [ "${TAG_RC}" = "0" ] && git tag --delete "v${VERSION}"
- [ "${COMMIT_RC}" = "0" ] && git reset HEAD~1
exit 1
}
release_start ()
{
- ROOT_DIR=$(git rev-parse --show-toplevel)
- [ -z "$(git status --porcelain)" ] || release_error "working directory not clean"
- DATE=$(date +"%Y-%m-%d")
+ ROOT_DIR="$(git rev-parse --show-toplevel)"
+ if [ -n "$(git status --porcelain)" ]; then
+ release_error "working directory not clean"
+ fi
VERSION=$("${ROOT_DIR}/version.sh" devel)
+ if git rev-parse "v${VERSION}"; then
+ release_error "tag v${VERSION} already exists"
+ fi
+ MSG=$(git log -1 --pretty=%B | tr -d "\n")
+ if [ "${MSG}" = "Version ${VERSION}" ]; then
+ release_error "commit for version already exists"
+ fi
+ DATE=$(date +"%Y-%m-%d")
BUILD_DIR="${ROOT_DIR}/release/${VERSION}"
if [ -d "${BUILD_DIR}" ]; then
release_error "directory ${BUILD_DIR} already exists"
@@ -69,9 +72,7 @@ release_commit_tag ()
{
cd "${ROOT_DIR}"
git commit -m "Version ${VERSION}" version.sh ChangeLog.adoc ReleaseNotes.adoc || release_error "git commit error, release already done?"
- export GIT_COMMIT_RC=$?
git tag -a "v${VERSION}" -m "WeeChat ${VERSION}"
- export GIT_TAG_RC=$?
}
release_build ()