-
Notifications
You must be signed in to change notification settings - Fork 36
/
publish-github-action.sh
executable file
·54 lines (39 loc) · 1.18 KB
/
publish-github-action.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
#!/bin/bash
set -e
root_dir=$PWD
VERSION=$1
directories_json_string_with_linebreaks=$2
directories_json_string="${directories_json_string_with_linebreaks//$'\\n'/''}"
directories=$(echo "$directories_json_string" | jq -c -r '.[]')
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json
# TODO we need to keep the dependencies.json file up-to-date as well
npm install
if [[ "$VERSION" == *"-rc."* ]];
then
npm publish --tag next
else
npm publish
fi
# TODO loop through checking for the status instead of sleeping
echo -e "sleeping for 30 seconds to ensure azle@$VERSION is fully registered on npm"
sleep 30
for directory in ${directories[@]}
do
cd $directory
sed -E -i "s/(\"azle\": \")(.*)(\")/\1$VERSION\3/" package.json
npm install
rm -rf node_modules
cd $root_dir
done
git add --all
git commit -am "azle-bot automated release $VERSION"
git push origin $GITHUB_HEAD_REF
git tag $VERSION
git push origin $VERSION
if [[ "$VERSION" == *"-rc."* ]];
then
gh release create "$VERSION" -t "$VERSION" --prerelease
else
gh release create "$VERSION" -t "$VERSION"
fi