-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathpublish.bash
More file actions
executable file
·34 lines (28 loc) · 880 Bytes
/
publish.bash
File metadata and controls
executable file
·34 lines (28 loc) · 880 Bytes
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
#!/bin/bash
# This script publishes the package to npm
# 1. runs the prepublish script to generate minimal package.json and hardhat.config.js
# 2. publishes the package
# 3. cleans up the files, restoring the original package.json and hardhat.config.ts
# 4. if published, commits and tags the release
# prepublish
# must run with hardhat to generate hardhat.config.js
yarn hardhat run scripts/template/prepublish.ts
if [ $? -ne 0 ]; then
echo "Prepublish failed"
exit 1
fi
# publish
yarn publish --non-interactive
published=$?
# clean up files
yarn hardhat clean
mv hardhat.config.ts.bak hardhat.config.ts
mv package.json.bak package.json
rm hardhat.config.js
# if published, commit and tag
if [ $published -eq 0 ]; then
version=v$(node -p "require('./package.json').version")
git add package.json
git commit -m "Publish $version"
git tag $version
fi