Better changelog generation when releasing new version (#4728)
* consolidate commiting in release pipeline; generate changelog before tagging * fix how rc0 is created
Paweł Krupa committed
Nov 23, 2018 at 14:46 UTC
b3723053755420b5df9e5a11ca6b115368f9b27a
4 files changed
+28
-25
.travis.yml
+1
@@ -62,6 +62,7 @@ jobs:
62
env: REPOSITORY="netdata/netdata"
63
- name: changelog generation
64
script: ".travis/generate_changelog.sh"
65
+ env: COMMIT_AND_PUSH=1
66
git:
67
depth: false
68
- name: labeler # This job should be replaced with GitHub Actions when they hit GA
.travis/generate_changelog.sh
+13
-4
@@ -8,11 +8,18 @@ then
8
exit 1
9
fi
10
11
+COMMIT_AND_PUSH=${COMMIT_AND_PUSH:-0}
12
ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}')
13
PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}')
14
GIT_MAIL=${GIT_MAIL:-"pawel+bot@netdata.cloud"}
15
GIT_USER=${GIT_USER:-"netdatabot"}
16
17
+if [ -z ${GIT_TAG+x} ]; then
18
+ OPTS=""
19
+else
20
+ OPTS="--future-release ${GIT_TAG}"
21
+fi
22
+
23
echo "--- Initialize git configuration ---"
24
git config user.email "${GIT_MAIL}"
25
git config user.name "${GIT_USER}"
@@ -27,10 +34,12 @@ docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest
34
--token "${GITHUB_TOKEN}" \
35
--since-tag "v1.10.0" \
36
--unreleased-label "**Next release**" \
30
- --no-compare-link \
31
- --exclude-labels duplicate,question,invalid,wontfix,discussion,documentation
37
+ --exclude-labels "stale,duplicate,question,invalid,wontfix,discussion,area/docs,needs triage" \
38
+ --no-compare-link ${OPTS}
39
40
echo "--- Uploading changelog ---"
41
git add CHANGELOG.md
35
-git commit -m '[ci skip] Automatic changelog update' || exit 0
36
-git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
42
+if [ "${COMMIT_AND_PUSH}" == "1" ]; then
43
+ git commit -m '[ci skip] Automatic changelog update' || exit 0
44
+ git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
45
+fi
.travis/releaser.sh
+9
-4
@@ -42,6 +42,15 @@ echo "---- FIGURING OUT TAGS ----"
42
#shellcheck source=/dev/null
43
source .travis/tagger.sh || exit 0
44
45
+echo "---- GENERATING CHANGELOG -----"
46
+./.travis/generate_changelog.sh
47
+
48
+echo "---- COMMIT AND PUSH CHANGES ----"
49
+git commit -m "[ci skip] release $GIT_TAG"
50
+git tag "$GIT_TAG" -a -m "Automatic tag generation for travis build no. $TRAVIS_BUILD_NUMBER"
51
+git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
52
+git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" --tags
53
+
54
echo "---- CREATING TAGGED DOCKER CONTAINERS ----"
55
export REPOSITORY="netdata/netdata"
56
./docker/build.sh
@@ -70,7 +79,3 @@ if [ -z ${RC+x} ]; then
79
else
80
hub release create --draft -a "netdata-${GIT_TAG}.tar.gz" -a "netdata-${GIT_TAG}.gz.run" -a "sha256sums.txt" -m "${GIT_TAG}" "${GIT_TAG}"
81
fi
73
-
74
-# Changelog needs to be created AFTER new release to avoid problems with circular dependencies and wrong entries in changelog file
75
-echo "---- GENERATING CHANGELOG -----"
76
-./.travis/generate_changelog.sh
.travis/tagger.sh
+5
-17
@@ -40,14 +40,14 @@ function embed_version {
40
function release_candidate {
41
LAST_TAG=$(git semver)
42
if [[ $LAST_TAG =~ -rc* ]]; then
43
- LAST_RELEASE=$(echo "$LAST_TAG" | cut -d'-' -f 1)
43
+ VERSION=$(echo "$LAST_TAG" | cut -d'-' -f 1)
44
LAST_RC=$(echo "$LAST_TAG" | cut -d'c' -f 2)
45
RC=$((LAST_RC + 1))
46
else
47
- LAST_RELEASE=$LAST_TAG
47
+ VERSION="$(git semver --next-minor)"
48
RC=0
49
fi
50
- GIT_TAG="v$LAST_RELEASE-rc$RC"
50
+ GIT_TAG="v$VERSION-rc$RC"
51
export GIT_TAG
52
}
53
@@ -62,20 +62,8 @@ if [ -z "${GIT_TAG}" ]; then
62
*"[netdata minor release]"*) GIT_TAG="v$(git semver --next-minor)" ;;
63
*"[netdata major release]"*) GIT_TAG="v$(git semver --next-major)" ;;
64
*"[netdata release candidate]"*) release_candidate ;;
65
- *) echo "Keyword not detected. Exiting..."; exit 1;;
65
+ *) echo "Keyword not detected. Exiting..."; exit 0;;
66
esac
67
- # Tag it!
68
- if [ "$GIT_TAG" != "HEAD" ]; then
69
- echo "Assigning a new tag: $GIT_TAG"
70
- embed_version "$GIT_TAG"
71
- git commit -m "[ci skip] release $GIT_TAG"
72
- git tag "$GIT_TAG" -a -m "Automatic tag generation for travis build no. $TRAVIS_BUILD_NUMBER"
73
- git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
74
- git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" --tags
75
- fi
76
-else
77
- embed_version "$GIT_TAG"
78
- git commit -m "[ci skip] release $GIT_TAG"
79
- git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
67
fi
68
+embed_version "$GIT_TAG"
69
export GIT_TAG