forked from FirebaseExtended/reactfire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·27 lines (23 loc) · 845 Bytes
/
build.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
SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)
TAG_TEST="^refs/tags/v.+$"
LATEST_TEST="^[^-]*$"
if [[ $GITHUB_REF =~ $TAG_TEST ]]; then
OVERRIDE_VERSION=${GITHUB_REF/refs\/tags\/v/}
if [[ $OVERRIDE_VERSION =~ $LATEST_TEST ]]; then
NPM_TAG=latest
else
# TODO when we hit 3.0.0 move back to next
NPM_TAG=latest
fi;
else
OVERRIDE_VERSION=$(node -e "console.log(require('./package.json').version)")-canary.$SHORT_SHA
NPM_TAG=canary
fi;
npm --no-git-tag-version --allow-same-version -f version $OVERRIDE_VERSION
yarn build
TARBALL=$(npm pack . | tail -n 1)
mv $TARBALL reactfire.tgz
echo "npm publish \$(dirname \"\$0\")/reactfire.tgz --tag $NPM_TAG" > ./publish.sh
chmod +x ./publish.sh
echo "tar -xzvf \$(dirname \"\$0\")/reactfire.tgz && rsync -a package/ ./" > ./unpack.sh
chmod +x ./unpack.sh