2022-04-22 21:16:09 +12:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-04-22 21:21:47 +12:00
|
|
|
if [[ -z "${CI}" ]]; then
|
|
|
|
echo 'Cannot run release.sh unless in CI'
|
|
|
|
exit 0
|
|
|
|
fi
|
2022-04-22 08:55:16 +12:00
|
|
|
|
2022-04-25 23:19:36 +12:00
|
|
|
#############################################
|
|
|
|
# SETUP #
|
|
|
|
#############################################
|
|
|
|
|
|
|
|
# Release pro with same version as budibase
|
2022-04-22 20:43:51 +12:00
|
|
|
VERSION=$(jq -r .version lerna.json)
|
2022-04-22 21:16:09 +12:00
|
|
|
echo "Version: $VERSION"
|
|
|
|
COMMAND=$1
|
|
|
|
echo "Command: $COMMAND"
|
2022-04-22 20:43:51 +12:00
|
|
|
|
2022-04-22 08:55:16 +12:00
|
|
|
# Determine tag to use
|
|
|
|
TAG=""
|
2022-04-22 21:40:17 +12:00
|
|
|
if [[ $COMMAND == "develop" ]]; then
|
2022-04-22 08:55:16 +12:00
|
|
|
TAG="develop"
|
|
|
|
else
|
|
|
|
TAG="latest"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Releasing version $VERSION"
|
|
|
|
echo "Releasing tag $TAG"
|
2022-04-25 23:19:36 +12:00
|
|
|
|
|
|
|
#############################################
|
|
|
|
# PRE-PUBLISH #
|
|
|
|
#############################################
|
|
|
|
|
|
|
|
# Go to pro repo root
|
|
|
|
cd ../budibase-pro
|
|
|
|
|
|
|
|
# Install NPM credentials
|
|
|
|
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
|
|
|
|
|
2022-07-07 23:02:13 +12:00
|
|
|
# Sync budibase dependency versions in packages/pro/package.json
|
2022-04-25 23:19:36 +12:00
|
|
|
# Ensures pro does not use out of date dependency
|
|
|
|
cd packages/pro
|
|
|
|
jq '.dependencies."@budibase/backend-core"="'$VERSION'"' package.json > package.json.tmp && mv package.json.tmp package.json
|
2022-07-07 23:02:13 +12:00
|
|
|
jq '.dependencies."@budibase/types"="'$VERSION'"' package.json > package.json.tmp && mv package.json.tmp package.json
|
2022-04-25 23:19:36 +12:00
|
|
|
|
|
|
|
# Go back to pro repo root
|
|
|
|
cd -
|
|
|
|
|
2022-07-28 05:42:06 +12:00
|
|
|
# Update lockfile with new dependency versions
|
|
|
|
yarn bootstrap
|
|
|
|
git add packages/pro/yarn.lock
|
|
|
|
|
2022-04-25 23:19:36 +12:00
|
|
|
#############################################
|
|
|
|
# PUBLISH #
|
|
|
|
#############################################
|
|
|
|
|
2022-04-22 21:21:47 +12:00
|
|
|
lerna publish $VERSION --yes --force-publish --dist-tag $TAG
|
2022-04-22 08:55:16 +12:00
|
|
|
|
2022-04-25 23:19:36 +12:00
|
|
|
#############################################
|
2022-05-24 23:18:39 +12:00
|
|
|
# POST-PUBLISH - PRO #
|
2022-04-25 23:19:36 +12:00
|
|
|
#############################################
|
|
|
|
|
|
|
|
# Revert build changes on packages/pro/package.json
|
2022-04-22 22:37:55 +12:00
|
|
|
cd packages/pro
|
2022-04-22 22:01:27 +12:00
|
|
|
jq '.main = "src/index.ts" | .types = "src/index.ts"' package.json > package.json.tmp && mv package.json.tmp package.json
|
2022-04-25 23:19:36 +12:00
|
|
|
|
|
|
|
# Go back to pro repo root
|
2022-04-22 23:10:39 +12:00
|
|
|
cd -
|
2022-04-25 23:19:36 +12:00
|
|
|
|
|
|
|
# Commit and push changes
|
2022-04-22 22:37:55 +12:00
|
|
|
git add packages/pro/package.json
|
2022-04-25 23:19:36 +12:00
|
|
|
git commit -m "Prep next development iteration"
|
2022-04-22 22:01:27 +12:00
|
|
|
git push
|
|
|
|
|
2022-04-25 23:19:36 +12:00
|
|
|
#############################################
|
|
|
|
# POST-PUBLISH - BUDIBASE #
|
|
|
|
#############################################
|
|
|
|
|
|
|
|
# Go to budibase repo root
|
2022-04-22 23:10:39 +12:00
|
|
|
cd ../budibase
|
2022-04-22 08:55:16 +12:00
|
|
|
|
2022-04-25 23:19:36 +12:00
|
|
|
# Update pro version in packages/server/package.json
|
|
|
|
cd packages/server
|
|
|
|
jq '.dependencies."@budibase/pro"="'$VERSION'"' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
|
|
|
|
|
|
# Go back to budibase repo root
|
|
|
|
cd -
|
|
|
|
|
|
|
|
# Update pro version in packages/worker/package.json
|
|
|
|
cd packages/worker
|
|
|
|
jq '.dependencies."@budibase/pro"="'$VERSION'"' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
|
|
|
2022-04-25 23:58:34 +12:00
|
|
|
# Go back to budibase repo root
|
|
|
|
cd -
|
|
|
|
|
2022-07-28 04:28:22 +12:00
|
|
|
# Update lockfile with new pro version
|
|
|
|
yarn bootstrap
|
|
|
|
|
2022-04-25 23:19:36 +12:00
|
|
|
# Commit and push changes
|
2022-04-25 23:58:34 +12:00
|
|
|
git add packages/server/package.json
|
2022-07-28 04:28:22 +12:00
|
|
|
git add packages/server/yarn.lock
|
2022-04-25 23:58:34 +12:00
|
|
|
git add packages/worker/package.json
|
2022-07-28 04:28:22 +12:00
|
|
|
git add packages/worker/yarn.lock
|
2022-04-25 23:19:36 +12:00
|
|
|
git commit -m "Update pro version to $VERSION"
|
2022-07-07 23:02:13 +12:00
|
|
|
git push
|