Update pro install and release scripts

This commit is contained in:
Rory Powell 2022-04-21 21:55:16 +01:00
parent 68d1654d15
commit cdb17748cb
5 changed files with 70 additions and 43 deletions

View File

@ -31,16 +31,8 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
# Add @budibase/pro to filesystem - name: Install Pro
- name: Checkout pro run: yarn install:pro
uses: actions/checkout@v2
with:
repository: budibase/budibase-pro
ref: ${{ env.BRANCH }}
path: './pro'
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Setup pro
run: mv pro ../budibase-pro && cd ../budibase-pro && yarn setup
- run: yarn - run: yarn
- run: yarn bootstrap - run: yarn bootstrap

View File

@ -25,26 +25,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF_NAME})"
id: extract_branch
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: 14.x node-version: 14.x
# Add @budibase/pro to filesystem - name: Install Pro
- name: Checkout pro run: yarn install:pro
uses: actions/checkout@v2
with:
repository: budibase/budibase-pro
ref: ${{ steps.extract_branch.outputs.branch }}
path: './pro'
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Setup pro
run: mv pro ../budibase-pro && cd ../budibase-pro && yarn setup
- run: yarn - run: yarn
- run: yarn bootstrap - run: yarn bootstrap
@ -69,21 +56,6 @@ jobs:
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
yarn release:develop yarn release:develop
- name: Get the latest budibase release version
id: version
run: |
release_version=$(cat lerna.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Publish @budibase/pro package to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ steps.previoustag.outputs.tag }}
run: |
cd ../budibase-pro
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
yarn release:develop $RELEASE_VERSION
- name: Build/release Docker images - name: Build/release Docker images
run: | run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

View File

@ -23,8 +23,10 @@
"setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev", "setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev",
"bootstrap": "lerna link && lerna bootstrap && ./scripts/link-dependencies.sh", "bootstrap": "lerna link && lerna bootstrap && ./scripts/link-dependencies.sh",
"build": "lerna run build", "build": "lerna run build",
"release": "lerna publish patch --yes --force-publish", "release": "lerna publish patch --yes --force-publish && yarn:release:pro",
"release:develop": "lerna publish prerelease --yes --force-publish --dist-tag develop", "release:develop": "lerna publish prerelease --yes --force-publish --dist-tag develop && yarn:release:pro:develop",
"release:pro": "sh ./scripts/pro/release.sh",
"release:pro:develop": "sh ./scripts/pro/release.sh develop",
"restore": "yarn run clean && yarn run bootstrap && yarn run build", "restore": "yarn run clean && yarn run bootstrap && yarn run build",
"nuke": "yarn run nuke:packages && yarn run nuke:docker", "nuke": "yarn run nuke:packages && yarn run nuke:docker",
"nuke:packages": "yarn run restore", "nuke:packages": "yarn run restore",
@ -71,6 +73,7 @@
"mode:cloud": "yarn env:selfhost:disable && yarn env:multi:enable && yarn env:account:disable", "mode:cloud": "yarn env:selfhost:disable && yarn env:multi:enable && yarn env:account:disable",
"mode:account": "yarn mode:cloud && yarn env:account:enable", "mode:account": "yarn mode:cloud && yarn env:account:enable",
"security:audit": "node scripts/audit.js", "security:audit": "node scripts/audit.js",
"postinstall": "husky install" "postinstall": "husky install",
"install:pro": "sh ./scripts/pro/install.sh"
} }
} }

20
scripts/pro/install.sh Executable file
View File

@ -0,0 +1,20 @@
if [[ -z "${CI}" ]]; then
echo 'Cannot run insall.sh unless in CI'
exit 0
fi
BRANCH=$1
cd ../
echo "Cloning pro repo..."
git clone git@github.com:Budibase/budibase-pro.git
cd budibase-pro
echo "Checkout branch $BRANCH"
# Try to checkout the matching pro branch
# If branch does not exist we will continue with default branch 'develop'
git checkout $BRANCH
git pull
echo "Initializing pro repo..."
yarn setup

40
scripts/pro/release.sh Executable file
View File

@ -0,0 +1,40 @@
if [[ -z "${CI}" ]]; then
echo 'Cannot run release.sh unless in CI'
exit 0
fi
# Go to pro package
cd ../budibase-pro
# Install NPM credentials
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
# Release pro as same version as budibase
VERSION=$(jq -r .version lerna.json)
# Determine tag to use
COMMAND=$1
TAG=""
if [[ $COMMAND == "develop" ]]
then
TAG="develop"
else
TAG="latest"
fi
echo "Releasing version $VERSION"
echo "Releasing tag $TAG"
lerna publish $VERSION --yes --force-publish --dist-tag $TAG
cd -
if [[ $COMMAND == "develop" ]]
then
# 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