-
Notifications
You must be signed in to change notification settings - Fork 3
/
release.sh
executable file
·42 lines (33 loc) · 1.26 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
#!/usr/bin/env bash
set -e
version=$(cat ./package.yaml | grep "version: " | sed -r 's/.{9}//')
name=$(cat ./package.yaml | grep "name: " | sed -r 's/.{6}//')
customDescription=$(cat ./package.yaml | grep "customDescription: " | sed -r 's/.{19}//')
./build.sh -c ./config/prod.json
rm -rf ./package
mkdir -p package
echo "{
\"name\": \"@maplelabs/${name}\",
\"version\": \"${version}\",
\"description\": \"${customDescription}\",
\"author\": \"Maple Labs\",
\"license\": \"AGPLv3\",
\"repository\": {
\"type\": \"git\",
\"url\": \"https://github.com/maple-labs/${name}.git\"
},
\"bugs\": {
\"url\": \"https://github.com/maple-labs/${name}/issues\"
},
\"homepage\": \"https://github.com/maple-labs/${name}\"
}" > package/package.json
mkdir -p package/artifacts
mkdir -p package/abis
paths=($(cat ./package.yaml | grep " - path:" | sed -r 's/.{10}//'))
names=($(cat ./package.yaml | grep " contractName:" | sed -r 's/.{18}//'))
for i in "${!paths[@]}"; do
cat ./out/dapp.sol.json | jq ".contracts | .\"${paths[i]}\" | .${names[i]}" > package/artifacts/${names[i]}.json
cat ./out/dapp.sol.json | jq ".contracts | .\"${paths[i]}\" | .${names[i]} | .abi" > package/abis/${names[i]}.json
done
npm publish ./package --access public
rm -rf ./package