forked from thirdweb-dev/contracts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
executable file
·58 lines (53 loc) · 1.13 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
set -e
POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
case $1 in
--local)
local=1
shift # past argument
;;
--no-build)
skip_build=1
shift # past argument
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
echo "### Release script started..."
if [[ $skip_build -eq 0 ]]; then
yarn build
fi
echo "### Build finished. Copying abis."
rm -rf contracts/abi
mkdir -p contracts/abi
# copy all abis to contracts/abi
find contract_artifacts ! -iregex ".*([a-zA-Z0-9_]).json" -exec cp {} contracts/abi 2>/dev/null \;
echo "### Copying README."
# copy root README to contracts folder
cp README.md contracts/README.md
# publish from contracts folder
cd contracts
echo "### Publishing..."
if [[ $local -eq 1 ]]; then
yalc push
else
np --any-branch --no-tests
fi
# delete copied README
rm README.md
# delete copied README
rm -rf node_modules
# delete copied README
rm -rf abi
# back to root folder
cd -
echo "### Done."