Skip to content

Commit f20c85f

Browse files
committed
Added showing release notes while upgrading
1 parent 922adb4 commit f20c85f

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Added showing release notes while upgrading
2+
13
## 1.0.1 (2018-06-06)
24
* Added Makefile.sample.mk
35
* Added CHANGELOG.md

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ USAGE
3939
SAMPLES
4040
-------
4141

42-
Basic command (you can copy and paste it into your Makefile)
42+
Basic commands (you can copy and paste it into your Makefile)
4343

4444
```makefile
4545
up: ## Start all or c=<name> containers in foreground

src/self-upgrade.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
#!/usr/bin/env sh
2+
# Get some property from release
3+
# Usage:
4+
# get_latest_release user/repo tag_name
25
get_latest_release() {
36
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
4-
grep '"tag_name":' | # Get tag line
7+
grep "\"$2\":" | # Get tag line
58
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
69
}
7-
v=$(get_latest_release $MK_REPO)
810

9-
if [ $v = $MK_VERSION ]; then
11+
# Getting last version
12+
NEW_VER=$(get_latest_release $MK_REPO tag_name)
13+
14+
if [ $NEW_VER = $MK_VERSION ]; then
1015
echo 'Up to date';
1116
else
12-
echo "A new version is available";
13-
echo "Upgrading from $MK_VERSION to $v";
14-
curl -sL https://raw.githubusercontent.com/$MK_REPO/master/scripts/upgrade.sh | ( echo "MK_REPO=$MK_REPO; MK_VERSION=$v; "; cat - ) | sh
17+
echo "A new version is available"
18+
body=$(get_latest_release $MK_REPO body)
19+
echo "Upgrading from $MK_VERSION to $NEW_VER
20+
21+
Release notes
22+
************************
23+
$body
24+
************************
25+
";
26+
# Downloading and executing upgrade script
27+
curl -sL https://raw.githubusercontent.com/$MK_REPO/master/scripts/upgrade.sh | ( echo "MK_REPO=$MK_REPO; MK_VERSION=$NEW_VER; "; cat - ) | sh
1528
fi;

0 commit comments

Comments
 (0)