-
-
Notifications
You must be signed in to change notification settings - Fork 329
/
Copy pathrelease.sh
executable file
·52 lines (44 loc) · 1.33 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
#!/bin/bash
set -euo pipefail
fail() {
echo "$@"
exit 2
}
git-tag() {
[ -z "$(git ls-files . --exclude-standard --others)" ] || fail "remove untracked files first"
git commit -am "${VERSION}"
git tag -a "${VERSION}" -m "${VERSION}"
git push
git push --tags
}
bump-docs() {
sed -i "s/${OLDVER}/${VERSION}/g" README.md
sed -i "s/${OLDVER}/${VERSION}/g" kube-derive/README.md
}
main() {
# Current master version is always the first one in kube/Cargo.toml
local -r VERSION="$(grep version kube/Cargo.toml | awk -F"\"" '{print $2}' | head -n 1)"
local -r OLDVER="$(grep "kube =" README.md | head -n 1 | awk -F"\"" '{print $2}')"
# bumping stage
if [[ "${VERSION}" != "${OLDVER}" ]]; then
[ -z "$(git status --porcelain)" ] || fail "deal with changes first"
echo "Bumping from ${OLDVER} -> ${VERSION}"
bump-docs
git-tag
git diff
exit 0
fi
}
# Usage:
#
# cargo release minor --exclude tests --exclude examples --skip-tag --skip-push --no-dev-version
# TODO: figure out why it needs waiting between publishing..
# TODO: consolidate-commits (release.toml option only, cant use because it lack other things)
# Then amend commits / squash. Maybe publish manually if it broke halfway through.
#
# Finally run this script to bump readme's and then tag.
#
# ./release.sh
#
# shellcheck disable=SC2068
main $@