diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-17 17:57:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-17 17:57:35 +0000 |
commit | 3b95e5be69c199a2a195c57aba12d88c242225ac (patch) | |
tree | 137b72ffaefe7f34bf21e975ccc9cc9ec0474564 /.travis/generate_changelog.sh | |
parent | Adding upstream version 1.13.0. (diff) | |
download | netdata-b9ac22f8da656f8703bea7c713068a397e01c714.tar.xz netdata-b9ac22f8da656f8703bea7c713068a397e01c714.zip |
Adding upstream version 1.14.0~rc0.upstream/1.14.0_rc0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.travis/generate_changelog.sh')
-rwxr-xr-x | .travis/generate_changelog.sh | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/.travis/generate_changelog.sh b/.travis/generate_changelog.sh index 4ae69f1c7..e48b42a66 100755 --- a/.travis/generate_changelog.sh +++ b/.travis/generate_changelog.sh @@ -1,29 +1,47 @@ #!/bin/bash - +# +# Changelog generation scriptlet. +# +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later +# +# Author : Pawel Krupa (paulfantom) +# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud) set -e -if [ ! -f .gitignore ]; then - echo "Run as ./travis/$(basename "$0") from top level directory of git repository" - exit 1 +# 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 -ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}') -PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}') +LAST_TAG="$1" +COMMITS_SINCE_RELEASE="$2" +NEW_VERSION="${LAST_TAG}-$((COMMITS_SINCE_RELEASE + 1))-nightly" +ORG=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f1) +PROJECT=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 2) 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 [ -z ${GIT_TAG+x} ]; then OPTS="" else OPTS="--future-release ${GIT_TAG}" fi -echo "--- Creating changelog ---" +echo "We got $COMMITS_SINCE_RELEASE changes since $LAST_TAG, re-generating changelog" +git config user.email "${GIT_MAIL}" +git config user.name "${GIT_USER}" git checkout master git pull + +echo "Running project markmandel for github changelog generation" #docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator:1.14.3 \ docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest \ - --user "${ORGANIZATION}" \ + --user "${ORG}" \ --project "${PROJECT}" \ --token "${GITHUB_TOKEN}" \ --since-tag "v1.10.0" \ @@ -31,3 +49,18 @@ docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest --exclude-labels "stale,duplicate,question,invalid,wontfix,discussion,no changelog" \ --no-compare-link ${OPTS} +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' && 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!" |