@cryptotaxi247 / netdata-1 / commits / 9ba9c8c9b

cleaner releaser.sh script (#4542)

[netdata minor release] and [minor] (just to be sure)

Paweł Krupa committed Nov 1, 2018 at 18:03 UTC 9ba9c8c9bcf6c8e4e4b1413d1a1a6c93f44477de
4 files changed +55 -31
.travis.yml
+7 -2
@@ -41,8 +41,9 @@ jobs:
41 script: ".travis/containerized_build.sh alpine"
42
43 - stage: packaging
44 - name: Update Changelog/Create release
45 - install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
44 + name: Create release
45 + install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot python-pip
46 + before_script: sudo pip install git-semver
47 script: ".travis/releaser.sh"
48 - name: Nightly tarball and self-extractor build
49 install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
@@ -53,6 +54,10 @@ jobs:
54 script: "docker/build.sh"
55 env: REPOSITORY="netdata/netdata"
56 if: type = cron
57 + - name: Nightly changelog generation
58 + script: ".travis/generate_changelog.sh"
59 + if: type = cron
60 +
61
62 notifications:
63 webhooks: https://app.fossa.io/hooks/travisci
.travis/README.md
+9 -3
@@ -55,9 +55,9 @@ This job is running one script called `releaser.sh`, which is responsible for a
55 automatically updates our CHANGELOG.md file based on GitHub features (mostly labels and pull requests). Apart from
56 that it can also create a new git tag and a github draft release connected to that tag.
57 Releases are generated by searching for a keyword in last commit message. Keywords are:
58 - - `[patch]` or `[fix]` to bump patch number
59 - - `[minor]`, `[feature]` or `[feat]` to bump minor number
60 - - `[major]` or `[breaking change]` to bump major number
58 + - `[netdata patch release]` to bump patch number
59 + - `[netdata minor release]` to bump minor number
60 + - `[netdata major release]` to bump major number
61 All keywords MUST be surrounded with square brackets.
62
63 Alternatively new release can be also created by pushing new tag to master branch.
@@ -72,3 +72,9 @@ cron). Combined they produce:
72
73 Currently "Nightly tarball and self-extractor build" is using old firehol script and it is planed to be replaced with
74 new design.
75 +
76 +##### Nightly changelog generation
77 +
78 +This job is responsible for regenerating changelog every day by executing `generate_changelog.sh` script. This is done
79 +only once a day due to github rate limiter.
80 +
.travis/generate_changelog.sh new
+30
@@ -0,0 +1,30 @@
1 +#!/bin/bash
2 +
3 +set -e
4 +
5 +if [ ! -f .gitignore ]
6 +then
7 + echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
8 + exit 1
9 +fi
10 +
11 +ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}')
12 +PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}')
13 +
14 +echo "--- Creating changelog ---"
15 +git checkout master
16 +git pull
17 +#docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator:1.14.3 \
18 +docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest \
19 + --user "${ORGANIZATION}" \
20 + --project "${PROJECT}" \
21 + --token "${GITHUB_TOKEN}" \
22 + --since-tag "v1.10.0" \
23 + --unreleased-label "**Next release**" \
24 + --no-compare-link \
25 + --exclude-labels duplicate,question,invalid,wontfix,discussion,documentation
26 +
27 +echo "--- Uploading changelog ---"
28 +git add CHANGELOG.md
29 +git commit -m '[ci skip] Automatic changelog update'
30 +git push "https://${GITHUB_TOKEN}:@${GIT_URL}"
.travis/releaser.sh
+9 -26
@@ -43,17 +43,22 @@ git config user.name "${GIT_USER}"
43 GIT_URL=$(git config --get remote.origin.url)
44 GIT_URL=${GIT_URL#*//}
45
46 -echo "---- FIGURING OUT TAGS-----"
46 +
47 +echo "---- GENERATING CHANGELOG -----"
48 +./.travis/generate_changelog.sh
49 +
50 +echo "---- FIGURING OUT TAGS ----"
51 # Check if current commit is tagged or not
52 GIT_TAG=$(git tag --points-at)
53 if [ -z "${GIT_TAG}" ]; then
54 + git semver || exit 1
55 # Figure out next tag based on commit message
56 GIT_TAG=HEAD
57 echo "Last commit message: $TRAVIS_COMMIT_MESSAGE"
58 case "${TRAVIS_COMMIT_MESSAGE}" in
54 - *"[patch]"*|*"[fix]"* ) GIT_TAG="v$(git semver --next-patch)" ;;
55 - *"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG="v$(git semver --next-minor)" ;;
56 - *"[major]"*|*"[breaking change]"* ) GIT_TAG="v$(git semver --next-major)" ;;
59 + *"[netdata patch release]"* ) GIT_TAG="v$(git semver --next-patch)" ;;
60 + *"[netdata minor release]"* ) GIT_TAG="v$(git semver --next-minor)" ;;
61 + *"[netdata major release]"* ) GIT_TAG="v$(git semver --next-major)" ;;
62 *) echo "Keyword not detected. Doing nothing" ;;
63 esac
64
@@ -65,28 +70,6 @@ if [ -z "${GIT_TAG}" ]; then
70 fi
71 fi
72
68 -# If GIT_TAG is still having value "HEAD" then script entered a state where there was no keyword in commit msg and commit wasn't tagged.
69 -# This condition can be triggered by a cron job and it shouldn't create a release but might be still useful for changelog generation.
70 -
71 -echo "---- CREATING CHANGELOG -----"
72 -#PREV_TAG=$(git describe --abbrev=0 "${GIT_TAG}"^)
73 -git checkout master
74 -git pull
75 -#docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator:1.14.3 \
76 -docker run -it -v "$(pwd)":/project markmandel/github-changelog-generator:latest \
77 - --user "${ORGANIZATION}" \
78 - --project "${PROJECT}" \
79 - --token "${GITHUB_TOKEN}" \
80 - --since-tag "v1.10.0" \
81 - --unreleased-label "**Next release**" \
82 - --no-compare-link \
83 - --exclude-labels duplicate,question,invalid,wontfix,discussion,documentation
84 -
85 -echo "---- UPLOADING CHANGELOG -----"
86 -git add CHANGELOG.md
87 -git commit -m '[ci skip] Automatic changelog update'
88 -git push "https://${GITHUB_TOKEN}:@${GIT_URL}" || exit 0 # Exit if changlog was already uploaded
89 -
73 if [ "${GIT_TAG}" == "HEAD" ]; then
74 echo "Not creating a release since neither of two conditions was met:"
75 echo " - keyword in commit message"