forked from ceramicnetwork/rust-ceramic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·58 lines (52 loc) · 1.56 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
#!/usr/bin/env bash
# Check specified release level based on commit messages, then if appropriate, release package
VALID_ARGS=$(getopt -o l: --long level: -- "$@")
if [[ $? -ne 0 ]]; then
exit 1;
fi
LEVEL=minor
eval set -- "$VALID_ARGS"
while [ : ]; do
case "$1" in
-l | --level)
LEVEL=echo "$2" | tr '[:upper:]' '[:lower:]'
case "$LEVEL" in
major|minor|patch) ;;
*)
echo "Invalid release level: $LEVEL"
exit 1
;;
esac
shift 2
;;
--) shift;
break
;;
esac
done
cd $(git rev-parse --show-toplevel)
# Using git cliff determine if there are any feat commits that do not belong to a tag.
git cliff --unreleased --strip all --body "{% for group, commits in commits | group_by(attribute=\"group\") %}
{{ group }} {{ commits | length }}
{% endfor %}" | grep Features
ret=$?
if [[ $ret = 0 ]] && [[ $LEVEL = patch ]]; then
echo "Cannot release patch version when there are unreleased features."
exit 1
fi
git config user.email "[email protected]"
git config user.name "Github Automation"
TAG=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"')
cargo release -vv $LEVEL \
--exclude ceramic-api-server \
--exclude ceramic-kubo-rpc-server \
--exclude iroh-bitswap \
--exclude iroh-car \
--exclude iroh-metrics \
--exclude iroh-rpc-client \
--exclude iroh-rpc-types \
--exclude iroh-store \
--exclude iroh-util \
--no-confirm \
--execute
gh release create v$TAG --title "v"$TAG --latest artifacts/**/*