-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease.sh
executable file
·79 lines (59 loc) · 2.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
set -e
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <version> <next-version>"
exit 2
fi
version="$1"
next_version="$2"
#if ! cargo install --list | grep 'cargo-edit: v0.8.0' ; then
# echo "Install cargo-edit: cargo install --version 0.8.0 --locked --features vendored-openssl cargo-edit"
# exit 1
#fi
if ! git config --get user.email > /dev/null && git config --get user.name > /dev/null; then
echo "Set git email and name: git config --global user.name <name> && git config --global user.email <email>"
exit 1
fi
head CHANGELOG.md
echo "Using version ${version} and next version ${next_version}"
echo "Confirm changelog looks good (y/n)? "
read good
if [ "${good}" != "y" ]; then
exit 1
fi
make_version() {
local readonly version="$1"
# requires cargo-edit
# set our workspace versions
cargo set-version --workspace "${version}"
# todo: why isn't this changed as part of set-version???
cargo add --manifest-path "$(pwd)/ts-bindgen-macro/Cargo.toml" --path ts-bindgen-gen "ts-bindgen-gen@${version}"
# set our end_to_end_template version
cp -r ts-bindgen-rt ts-bindgen-gen/tests/end_to_end_template/
cargo add --manifest-path "$(pwd)/ts-bindgen-gen/tests/end_to_end_template/Cargo.toml" --path ts-bindgen-gen/tests/end_to_end_template/ts-bindgen-rt "ts-bindgen-rt@${version}"
cargo generate-lockfile --manifest-path "$(pwd)/ts-bindgen-gen/tests/end_to_end_template/Cargo.toml"
rm -rf ts-bindgen-gen/tests/end_to_end_template/ts-bindgen-rt
# set our ts-bindgen-web version
cargo set-version --manifest-path "$(pwd)/ts-bindgen-web/Cargo.toml" "${version}"
cargo add --manifest-path "$(pwd)/ts-bindgen-web/Cargo.toml" --no-default-features --path ts-bindgen "ts-bindgen@${version}"
cargo generate-lockfile --manifest-path "$(pwd)/ts-bindgen-web/Cargo.toml"
# set paperjs example version
cargo set-version --manifest-path "$(pwd)/ts-bindgen/examples/paperjs/Cargo.toml" "${version}"
cargo add --manifest-path "$(pwd)/ts-bindgen/examples/paperjs/Cargo.toml" --path ts-bindgen-rt "ts-bindgen-rt@${version}"
cargo generate-lockfile --manifest-path "$(pwd)/ts-bindgen/examples/paperjs/Cargo.toml"
echo "Update README.md versions"
echo "Ready to proceed (y/n)? "
read good
if [ "${good}" != "y" ]; then
exit 1
fi
cargo test
if [[ "${version}" =~ ".*-pre" ]]; then
git commit -a -m "chore: prepare ${version}"
else
git commit -a -m "chore: release ${version}"
git tag "v${version}"
fi
}
make_version "${version}"
make_version "${next_version}"
echo "Run: git checkout v${version} && cd ts-bindgen-web && ./build && wrangler publish"