Skip to content

Commit 07d1a27

Browse files
committed
Merge pull request #80 from mboersma/add-changelog
feat(_scripts): add CHANGELOG.md and generator script
2 parents 0407dfe + 70cea4d commit 07d1a27

2 files changed

Lines changed: 102 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### 2.0.0-alpha -> v2.0.0-beta1
2+
3+
#### Features
4+
5+
- [`44f6cfe`](https://github.com/deis/postgres/commit/44f6cfe258c2438cf83635b4bef910119b7b8d99) postgres: run periodic backups in the background
6+
- [`ac4b163`](https://github.com/deis/postgres/commit/ac4b1639059e6b0fe02faa84b9e43531b7656476) create_bucket: raise client error if status code != 404
7+
- [`b59fccf`](https://github.com/deis/postgres/commit/b59fccf3880050c353da9e6b90e67d5bd96bdfef) contrib: add back integration tests
8+
- [`3615256`](https://github.com/deis/postgres/commit/3615256d8d86ab233253f59257e052863cfa0e7e) postgres: install wal-e for continuous backups
9+
- [`b91db20`](https://github.com/deis/postgres/commit/b91db20ec3cfbc25cce644526c949e082cd90cd8) .travis.yml: have this job notify its sister job in Jenkins
10+
11+
#### Fixes
12+
13+
- [`2e95058`](https://github.com/deis/postgres/commit/2e95058318b9c395c134fac39420da166ad02c38) README: revert README template
14+
- [`dc02898`](https://github.com/deis/postgres/commit/dc02898ef3cc231f0cc4b125f367444a4ab9cab9) rootfs: install wal-e from commit
15+
- [`f717c24`](https://github.com/deis/postgres/commit/f717c24b28f5fc72dbf8e982d0dcb7e14ba4d0b2) docker-entrypoint-initdb: bump wait timeout
16+
- [`4aa3808`](https://github.com/deis/postgres/commit/4aa38080f0724244323c926d62fc75ecd7b7dc99) setup-envdir: write only host if port == 80
17+
- [`16d1362`](https://github.com/deis/postgres/commit/16d13629d72a512b9f99521de2064d5cf0f254b5) docker-entrypoint-initdb.d: fixup envvar evaluation
18+
19+
#### Maintenance
20+
21+
- [`1bbac54`](https://github.com/deis/postgres/commit/1bbac546ed8682b62cedf0db99048e1b19d469be) Makefile: Use immutable tags
22+
- [`2c7acd4`](https://github.com/deis/postgres/commit/2c7acd425aae8427e98863b43e08ba2c7495639a) release: bump version to v2-beta
23+
24+
### 2.0.0-alpha
25+
26+
#### Documentation
27+
28+
- [`1334843`](https://github.com/deis/postgres/commit/133484310c213a244f6c0d0759948d62de6bddab) readme: change pod name
29+
30+
#### Maintenance
31+
32+
- [`8f15367`](https://github.com/deis/postgres/commit/8f153673bc4353241604bf442ad9a9fd4307856b) release: set version and lock to deis registry
33+
- [`2a3fea3`](https://github.com/deis/postgres/commit/2a3fea33624d43c7f432b103554f5b07f92b88c9) deploy.sh: adhere to standard location

_scripts/generate-changelog.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
# vim: et tw=0 sw=4 ts=4
3+
4+
REPOROOT=${REPOROOT:=https://github.com/deis/postgres}
5+
TYPES=${TYPES:=feat(;Features fix(;Fixes docs(;Documentation chore(;Maintenance}
6+
7+
usage() {
8+
echo "Usage: $0 <from> [to]
9+
10+
The REPOROOT and TYPES variables may be used to customize what links are
11+
generated and what is scraped from the commit logs. Current settings are:
12+
13+
REPOROOT=$REPOROOT
14+
TYPES=$TYPES
15+
"
16+
}
17+
18+
# Print the information scraped from git
19+
retrieve() {
20+
while read -r commit hash message; do
21+
# Extract the subsystem where type(subsystem): message
22+
SUBSYSTEM=$(echo "$message" | cut -d'(' -f2 | cut -d')' -f1 | sed 's/\*/\(all\)/g')
23+
# Extract the message where type(subsystem): message
24+
MESSAGE=$(echo "$message" | awk -F ")" '{ print $2}' | sed 's/://' | cut -f2- -d' ')
25+
# Generate a link to the full legal commit on GitHub
26+
LINK="$REPOROOT/commit/$hash"
27+
# Echo all this in a way that makes the commit hash and message a link
28+
# to the commit in markdown
29+
echo ' -' "[\`$commit\`]($LINK)" "$SUBSYSTEM": "$MESSAGE"
30+
done < <(git --no-pager log --oneline --merges --oneline --format="%h %H %b" --grep="$1" "$FROM".."$TO")
31+
# Scrape the information from git
32+
}
33+
34+
# Wrap feature type and show its relevant commits
35+
subheading() {
36+
echo "#### $1"
37+
echo
38+
retrieve "$2"
39+
echo
40+
}
41+
42+
main() {
43+
# Print usage summary if user didn't specify a beginning
44+
if [ -z "$1" ]; then
45+
usage
46+
exit 1
47+
fi
48+
49+
FROM=$1
50+
TO=${2:-"HEAD"}
51+
52+
printf "### %s -> %s\n\n" "$FROM" "$TO"
53+
54+
# Iterate over the types of messages specified
55+
for LEGALTYPE in $TYPES; do
56+
SHORT=$(echo "$LEGALTYPE" | cut -f1 -d';')
57+
LONG=$(echo "$LEGALTYPE" | cut -f2 -d';')
58+
subheading "$LONG" "$SHORT"
59+
done
60+
}
61+
62+
if [ $SHLVL -eq 2 ]; then
63+
# If this is being run as a command
64+
main "$@"
65+
else
66+
# Otherwise this is being sourced
67+
unset -f main
68+
unset -f usage
69+
fi

0 commit comments

Comments
 (0)