-
Notifications
You must be signed in to change notification settings - Fork 16
/
release.sh
executable file
·93 lines (73 loc) · 2.12 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Semi-automated script to create a new release, including generating changelog, tag, building etc.
# Adopted from https://github.com/phil294/git-log--graph/blob/master/release.sh
set -e
set -o pipefail
pause() {
read -r -n 1 -s -p 'Press any key to continue. . .'
echo
}
echo update readme
pause
if ! [ -z "$(sc git status --porcelain)" ]; then
echo 'sc git working tree not clean'
exit 1
fi
if grep -R -n -E '\s$' src; then
echo 'trailing whitespace found'
exit 1
fi
if grep -R -n 'p! ' src; then
echo 'p! found'
exit 1
fi
doc_validation_errors=$(sc tidy -errors -q docs/index.html 2>&1 | grep -v -- ' - Warning: ') ||:
if ! [ -z "$doc_validation_errors" ]; then
echo "docs/index.html contains invalid html:\n${doc_validation_errors}"
exit 1
fi
echo 'validate html'
pause
echo 'update shard.yml version (no commit)'
pause
version=$(shards version)
rm -f ahk_x11.AppImage bin/ahk_x11 bin/ahk_x11.dev
docker run --rm -it -v /b/ahk_x11:/a -w /a --privileged ahk_x11-builder-ubuntu.20.04 \
make ahk_x11.AppImage
bin=ahk_x11.AppImage
cp "$bin" "$bin.release"
ls -lah "$bin"
pause
make ahk_x11.deb
bin_deb="ahk-x11_${version}-1_all.deb"
ls -lah "$bin_deb"
pause
make test-appimage
pause
echo test installers
pause
sc git fetch
release_message=$(sc git log --reverse "$(sc git describe --tags --abbrev=0)".. --pretty=format:"%h___%B" |grep . |sed -E 's/^([0-9a-f]{6,})___(.)/- [`\1`](https:\/\/github.com\/phil294\/ahk_x11\/commit\/\1) \U\2/')
echo edit release message
pause
release_message=$(micro <<< "$release_message")
[ -z "$release_message" ] && exit 1
echo release_message:
echo "$release_message"
sc git add README.md ||:
sc git add shard.yml
sc git commit -m "$version"
sc git tag "$version"
echo 'committed, tagged'
pause
sc git push --tags origin master
if [[ -z $version || -z $release_message ]]; then
echo version/release_message empty
exit 1
fi
echo 'will create github release'
pause
gh release create "$version" --target master --title "$version" --notes "$release_message" --verify-tag "$bin" "$bin_deb"
echo 'github release created'
echo 'update dependent projects'
pause