budibase/scripts/pro/release.sh

51 lines
1.2 KiB
Bash
Raw Normal View History

2022-04-22 11:16:09 +02:00
#!/bin/bash
2022-04-22 11:21:47 +02:00
if [[ -z "${CI}" ]]; then
echo 'Cannot run release.sh unless in CI'
exit 0
fi
2022-04-21 22:55:16 +02:00
2022-04-22 10:43:51 +02:00
# Release pro as same version as budibase
VERSION=$(jq -r .version lerna.json)
2022-04-22 11:16:09 +02:00
echo "Version: $VERSION"
COMMAND=$1
echo "Command: $COMMAND"
2022-04-22 10:43:51 +02:00
2022-04-21 22:55:16 +02:00
# Go to pro package
cd ../budibase-pro
# Install NPM credentials
2022-04-22 11:21:47 +02:00
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
2022-04-21 22:55:16 +02:00
# Determine tag to use
TAG=""
2022-04-22 11:40:17 +02:00
if [[ $COMMAND == "develop" ]]; then
2022-04-21 22:55:16 +02:00
TAG="develop"
else
TAG="latest"
fi
echo "Releasing version $VERSION"
echo "Releasing tag $TAG"
2022-04-22 11:21:47 +02:00
lerna publish $VERSION --yes --force-publish --dist-tag $TAG
2022-04-21 22:55:16 +02:00
2022-04-22 12:01:27 +02:00
# reset main and types to point to src for dev
2022-04-22 12:37:55 +02:00
cd packages/pro
2022-04-22 12:01:27 +02:00
jq '.main = "src/index.ts" | .types = "src/index.ts"' package.json > package.json.tmp && mv package.json.tmp package.json
2022-04-22 12:37:55 +02:00
cd ../../
git add packages/pro/package.json
2022-04-22 12:01:27 +02:00
git commit -m 'Prep dev'
git push
2022-04-21 22:55:16 +02:00
cd -
2022-04-22 11:40:17 +02:00
if [[ $COMMAND == "develop" ]]; then
2022-04-21 22:55:16 +02:00
# Pin pro version for develop container build
echo "Pinning pro version"
cd packages/server
jq '.dependencies."@budibase/pro"="'$VERSION'"' package.json > package.json.tmp && mv package.json.tmp package.json
cd -
cd packages/worker
jq '.dependencies."@budibase/pro"="'$VERSION'"' package.json > package.json.tmp && mv package.json.tmp package.json
fi