summaryrefslogtreecommitdiffstats
path: root/.travis/generate_changelog_for_nightlies.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:08:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:08:07 +0000
commitc69cb8cc094cc916adbc516b09e944cd3d137c01 (patch)
treef2878ec41fb6d0e3613906c6722fc02b934eeb80 /.travis/generate_changelog_for_nightlies.sh
parentInitial commit. (diff)
downloadnetdata-c69cb8cc094cc916adbc516b09e944cd3d137c01.tar.xz
netdata-c69cb8cc094cc916adbc516b09e944cd3d137c01.zip
Adding upstream version 1.29.3.upstream/1.29.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.travis/generate_changelog_for_nightlies.sh')
-rwxr-xr-x.travis/generate_changelog_for_nightlies.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/.travis/generate_changelog_for_nightlies.sh b/.travis/generate_changelog_for_nightlies.sh
new file mode 100755
index 0000000..59173af
--- /dev/null
+++ b/.travis/generate_changelog_for_nightlies.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+#
+# Changelog generation scriptlet, for nightlies
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Pawel Krupa (paulfantom)
+# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
+set -e
+
+# If we are not in netdata git repo, at the top level directory, fail
+TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
+CWD=$(git rev-parse --show-cdup || echo "")
+if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
+ echo "Run as .travis/$(basename "$0") from top level directory of netdata git repository"
+ echo "Changelog generation process aborted"
+ exit 1
+fi
+
+LAST_TAG="$1"
+COMMITS_SINCE_RELEASE="$2"
+NEW_VERSION="${LAST_TAG}-$((COMMITS_SINCE_RELEASE + 1))-nightly"
+GIT_MAIL=${GIT_MAIL:-"bot@netdata.cloud"}
+GIT_USER=${GIT_USER:-"netdatabot"}
+PUSH_URL=$(git config --get remote.origin.url | sed -e 's/^https:\/\///')
+FAIL=0
+
+if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then
+ echo "Beta mode on ${TRAVIS_REPO_SLUG}, nothing else to do here"
+ exit 0
+fi
+
+echo "Running changelog creation mechanism"
+.travis/create_changelog.sh
+
+echo "Changelog created! Adding packaging/version(${NEW_VERSION}) and CHANGELOG.md to the repository"
+echo "${NEW_VERSION}" > packaging/version
+git add packaging/version && echo "1) Added packaging/version to repository" || FAIL=1
+git add CHANGELOG.md && echo "2) Added changelog file to repository" || FAIL=1
+git commit -m '[ci skip] create nightly packages and update changelog' --author "${GIT_USER} <${GIT_MAIL}>" && echo "3) Committed changes to repository" || FAIL=1
+git push "https://${GITHUB_TOKEN}:@${PUSH_URL}" && echo "4) Pushed changes to remote ${PUSH_URL}" || FAIL=1
+
+# In case of a failure, wrap it up and bail out cleanly
+if [ $FAIL -eq 1 ]; then
+ git clean -xfd
+ echo "Changelog generation failed during github UPDATE!"
+ exit 1
+fi
+
+echo "Changelog generation completed successfully!"