X Tutup
Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 195b704

Browse files
committed
Changelog: Added changelog.sh script
1 parent 254ae24 commit 195b704

File tree

2 files changed

+82
-3
lines changed

2 files changed

+82
-3
lines changed

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
### MacOS ###
2+
.DS_Store
3+
14
### Vagrant ###
25
.vagrant/
36
*.box
47

5-
### MacOS ###
6-
.DS_Store
7-
88
### Python ###
99
*.pyc
1010

@@ -21,3 +21,6 @@
2121
/backup_config.yml
2222
/backup_excludes_list.txt
2323
/*.log
24+
25+
### Misc ###
26+
/changelog.txt

scripts/changelog.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env bash
2+
#########################################################################
3+
# Title: Changelog Builder #
4+
# Author(s): desimaniac #
5+
# URL: https://github.com/cloudbox/cloudbox #
6+
# Description: Prints out new version's changelog. #
7+
# -- #
8+
# Part of the Cloudbox project: https://cloudbox.works #
9+
#########################################################################
10+
# GNU General Public License v3.0 #
11+
#########################################################################
12+
13+
################################
14+
# Variables
15+
################################
16+
17+
# Constants
18+
readonly CHANGELOG="changelog.txt"
19+
readonly DATE=$(date +"%Y-%m-%d")
20+
readonly REPO="https://github.com/cloudbox/cloudbox"
21+
readonly PREVIOUS_VERSION=$(git describe --abbrev=0 --tags)
22+
readonly NEXT_VERSION=$(echo $PREVIOUS_VERSION | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
23+
24+
################################
25+
# Main
26+
################################
27+
28+
# Cleanup
29+
[ -e $CHANGELOG ] && rm $CHANGELOG
30+
31+
# Header
32+
echo \
33+
-e \
34+
"\n## [$NEXT_VERSION][] - $DATE\n" \
35+
>> changelog.txt
36+
37+
# List of commits
38+
git \
39+
log \
40+
--reverse \
41+
--pretty=format:"%s ([#%h][])" \
42+
develop...master | \
43+
sed 's/\(^[^:]*\):/- **\1**:/g' | \
44+
sed 's/\[skip ci\]//g' | \
45+
sed 's/\[minor\]//g' \
46+
>> $CHANGELOG
47+
48+
# Whitespace
49+
echo "" >> $CHANGELOG
50+
51+
# Header Link
52+
echo \
53+
-e \
54+
"[$NEXT_VERSION]: $REPO/compare/$PREVIOUS_VERSION...$NEXT_VERSION" \
55+
>> $CHANGELOG
56+
57+
# List of reference links
58+
git \
59+
log \
60+
--reverse \
61+
--pretty=format:"[#%h]: $REPO/commit/%h" \
62+
develop...master \
63+
>> $CHANGELOG
64+
65+
# Whitespace
66+
echo "" >> $CHANGELOG
67+
68+
# Display $CHANGELOG
69+
if [[ "$OSTYPE" == "linux-gnu" ]]; then
70+
cat $CHANGELOG
71+
elif [[ "$OSTYPE" == "darwin"* ]]; then
72+
cat $CHANGELOG
73+
if [ -x "$(command -v atom)" ]; then
74+
atom $CHANGELOG
75+
fi
76+
fi

0 commit comments

Comments
 (0)
X Tutup