-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·121 lines (106 loc) · 2.86 KB
/
release.sh
File metadata and controls
executable file
·121 lines (106 loc) · 2.86 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env bash
set -ex
function nope() {
set +x
echo
echo "${2} Refusing to proceed."
echo
exit $1
}
cd "$(dirname "$0")"
BRANCH="$(git name-rev --name-only --exclude 'remotes/*' --exclude 'tags/*' HEAD)"
if [ "${BRANCH}" != "master" ]; then
nope 1 "You can only release from 'master', not '${BRANCH}'."
fi
if ! git diff --quiet; then
nope 2 "Working copy is dirty."
fi
if git log --oneline | grep -E 'fixup|WIP|DEV'; then
nope 9 "Found temp commits in log."
fi
if ! grep -qE '^### Bleeding Edge' documentation/docs/versions/index.md; then
nope 10 "No docs for this release."
fi
git fetch
if [ "$(git rev-parse origin/master)" != "$(git merge-base master origin/master)" ]; then
nope 6 "Your 'master' is out of date; need to pull and merge."
fi
# build
make clean
if ! git diff --quiet; then
nope 3 "Clean created dirtiness"
fi
make test all
if ! git diff --quiet; then
nope 4 "Build created dirtiness"
fi
cp jnc/target/bin/jnc bin
strip bin/jnc
cp jstdlib/target/lib/jstdlib.o lib
cp jstdlib/target/lib/jstdlib.jnh lib
if ! make clean test all not_quite_lisp; then
nope 7 "Not Quite Lisp doesn't work anymore"
fi
git add --force bin/jnc lib/jstdlib.o lib/jstdlib.jnh
./johanndoc.sh
# version numbers
DOC_FILE=documentation/docs/system/index.md
LINE=$(grep -Fn '% ./jnc/target/bin/jnc --version' $DOC_FILE | cut -d : -f 1)
{
head -n $LINE $DOC_FILE
./bin/jnc --version
LINE=$(( LINE + 4 ))
tail -n +$LINE $DOC_FILE | head -n 1
LINE=$(( LINE + 4 ))
echo "pub fn main(){}" | ./bin/jnc | head -n 3
tail -n +$LINE $DOC_FILE
} > tmp.md
mv tmp.md $DOC_FILE
# system software
DOC_FILE=documentation/docs/system/index.md
LINE=$(grep -Fn '<!--{systemsoftware}-->' $DOC_FILE | cut -d : -f 1)
{
head -n $LINE $DOC_FILE
echo '```'
echo '% uname -a'
uname -a
echo "%"
echo '% make --version'
make --version
echo "%"
echo '% gcc --version'
gcc --version
echo "%"
echo '% ld -v'
ld -v 2>&1
echo '```'
LINE=$(grep -Fn '<!--{/systemsoftware}-->' $DOC_FILE | cut -d : -f 1)
tail -n +$LINE $DOC_FILE
} > tmp.md
mv tmp.md $DOC_FILE
# update release history
VERSION="v$(./bin/jnc -v | cut -d ' ' -f 2 | cut -d - -f 1)"
DOC_FILE=documentation/docs/versions/index.md
LINE=$(grep -Fn '### Bleeding Edge' $DOC_FILE | cut -d : -f 1)
if [ -z "$LINE" ]; then
nope 8 "Didn't find 'Bleeding Edge' heading in release history to promote."
fi
{
LINE=$(( LINE - 1 ))
head -n $LINE $DOC_FILE
echo '[//]: # (### Bleeding Edge)'
echo
echo '### `'"$VERSION"'`'
echo
LINE=$(( LINE + 3 ))
tail -n +$LINE $DOC_FILE
} > tmp.md
mv tmp.md $DOC_FILE
git add documentation
# commit and tag
git commit -a -m "Add ${VERSION} release binaries"
make clean test all
if ! git diff --quiet; then
nope 5 "Release created dirtiness"
fi
git tag -a -m "Release ${VERSION}" "${VERSION}"