Merge branch 'chore/npmless-builds' into chore/esbuild

# Conflicts:
#	packages/pro
#	yarn.lock
This commit is contained in:
Adria Navarro 2023-05-04 10:32:58 +01:00
commit cc83d7458e
22 changed files with 350 additions and 88 deletions

View File

@ -3,19 +3,14 @@ concurrency: release-prerelease
on:
push:
branches:
- develop
paths:
- ".aws/**"
- ".github/**"
- "charts/**"
- "packages/**"
- "scripts/**"
- "package.json"
- "yarn.lock"
- "package.json"
- "yarn.lock"
tags:
- v*-alpha.*
workflow_dispatch:
inputs:
tags:
description: "Release tag"
required: true
type: boolean
env:
# Posthog token used by ui at build time
@ -30,24 +25,38 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fail if branch is not develop
if: github.ref != 'refs/heads/develop'
run: |
echo "Ref is not develop, you must run this job from develop."
exit 1
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 1
- name: Fail if tag is not develop
run: |
if ! git merge-base --is-ancestor ${{ github.sha }} origin/develop; then
echo "Tag is not in develop"
exit 1
fi
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn
- name: Update versions
run: |
version=$(cat lerna.json \
| grep version \
| head -1 \
| awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \
| sed 's/[",]//g')
echo "Setting version $version"
yarn lerna exec "yarn version --no-git-tag-version --new-version=$version"
node scripts/syncLocalDependencies.js $version
yarn
- run: yarn bootstrap
- run: yarn build
- run: yarn build:sdk
# - run: yarn test
- name: Publish budibase packages to NPM
env:
@ -56,6 +65,8 @@ jobs:
# setup the username and email.
git config --global user.name "Budibase Staging Release Bot"
git config --global user.email "<>"
git submodule foreach git commit -a -m 'Release process'
git commit -a -m 'Release process'
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
yarn release:develop
@ -84,7 +95,7 @@ jobs:
git config user.name "Budibase Helm Bot"
git config user.email "<>"
git reset --hard
git pull
git fetch
mkdir sync
echo "Packaging chart to sync dir"
helm package charts/budibase --version 0.0.0-develop --app-version develop --destination sync

View File

@ -3,29 +3,16 @@ concurrency: release
on:
push:
branches:
- master
paths:
- ".aws/**"
- ".github/**"
- "charts/**"
- "packages/**"
- "scripts/**"
- "package.json"
- "yarn.lock"
- "package.json"
- "yarn.lock"
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# Exclude all pre-releases
- '!v*[0-9]+.[0-9]+.[0-9]+-*'
workflow_dispatch:
inputs:
versioning:
type: choice
description: "Versioning type: patch, minor, major"
default: patch
options:
- patch
- minor
- major
tags:
description: "Release tag"
required: true
type: boolean
env:
# Posthog token used by ui at build time
@ -38,20 +25,35 @@ jobs:
release-images:
runs-on: ubuntu-latest
steps:
- name: Fail if branch is not master
if: github.ref != 'refs/heads/master'
run: |
echo "Ref is not master, you must run this job from master."
exit 1
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 1
- name: Fail if branch is not master
if: github.ref != 'refs/heads/master'
run: |
echo "Ref is not master, you must run this job from master."
// Change to "exit 1" when merged. Left to 0 to not fail all the pipelines and not to cause noise
exit 0
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn
- name: Update versions
run: |
version=$(cat lerna.json \
| grep version \
| head -1 \
| awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \
| sed 's/[",]//g')
echo "Setting version $version"
yarn lerna exec "yarn version --no-git-tag-version --new-version=$version"
node scripts/syncLocalDependencies.js $version
yarn
- run: yarn bootstrap
- run: yarn lint
- run: yarn build
@ -65,6 +67,8 @@ jobs:
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default
git config --global user.name "Budibase Release Bot"
git config --global user.email "<>"
git submodule foreach git commit -a -m 'Release process'
git commit -a -m 'Release process'
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
yarn release
@ -103,7 +107,7 @@ jobs:
git config user.name "Budibase Helm Bot"
git config user.email "<>"
git reset --hard
git pull
git fetch
mkdir sync
echo "Packaging chart to sync dir"
helm package charts/budibase --version 0.0.0-master --app-version v"$RELEASE_VERSION" --destination sync

38
.github/workflows/tag-prerelease.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Tag prerelease
concurrency: release-prerelease
on:
push:
branches:
- develop
paths:
- ".aws/**"
- ".github/**"
- "charts/**"
- "packages/**"
- "scripts/**"
- "package.json"
- "yarn.lock"
workflow_dispatch:
jobs:
tag-prerelease:
runs-on: ubuntu-latest
steps:
- name: Fail if branch is not develop
if: github.ref != 'refs/heads/develop'
run: |
echo "Ref is not develop, you must run this job from develop."
exit 1
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Tag prerelease
run: |
# setup the username and email.
git config --global user.name "Budibase Staging Release Bot"
git config --global user.email "<>"
./scripts/versionCommit.sh alpha

48
.github/workflows/tag-release.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Tag prerelease
concurrency: release-prerelease
on:
push:
branches:
- master
paths:
- ".aws/**"
- ".github/**"
- "charts/**"
- "packages/**"
- "scripts/**"
- "package.json"
- "yarn.lock"
workflow_dispatch:
inputs:
versioning:
type: choice
description: "Versioning type: patch, minor, major"
default: patch
options:
- patch
- minor
- major
required: true
jobs:
tag-prerelease:
runs-on: ubuntu-latest
steps:
- name: Fail if branch is not master
if: github.ref != 'refs/heads/master'
run: |
echo "Ref is not master, you must run this job from master."
exit 1
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Tag prerelease
run: |
# setup the username and email.
git config --global user.name "Budibase Staging Release Bot"
git config --global user.email "<>"
./scripts/versionCommit.sh ${{ github.event.inputs.versioning }}

View File

@ -24,6 +24,7 @@
"typescript": "4.7.3"
},
"scripts": {
"preinstall": "node scripts/syncProPackage.js",
"setup": "git config submodule.recurse true && git submodule update && node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev",
"bootstrap": "./scripts/bootstrap.sh && lerna link && ./scripts/link-dependencies.sh",
"build": "lerna run --stream build",
@ -32,8 +33,8 @@
"backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'",
"build:sdk": "lerna run --stream build:sdk",
"deps:circular": "madge packages/server/dist/index.js packages/worker/src/index.ts packages/backend-core/dist/src/index.js packages/cli/src/index.js --circular",
"release": "lerna publish ${RELEASE_VERSION_TYPE:-patch} --yes --force-publish && yarn release:pro",
"release:develop": "lerna publish prerelease --yes --force-publish --dist-tag develop --exact && yarn release:pro:develop",
"release": "lerna publish ${RELEASE_VERSION_TYPE:-patch} --yes --force-publish --no-git-tag-version --no-push --no-git-reset",
"release:develop": "lerna publish from-package --yes --force-publish --dist-tag develop --exact --no-git-tag-version --no-push --no-git-reset",
"restore": "yarn run clean && yarn run bootstrap && yarn run build",
"nuke": "yarn run nuke:packages && yarn run nuke:docker",
"nuke:packages": "yarn run restore",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -22,7 +22,7 @@
"dependencies": {
"@budibase/nano": "10.1.2",
"@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.5.10-alpha.0",
"@budibase/types": "0.0.1",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,8 +38,8 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/shared-core": "2.5.10-alpha.0",
"@budibase/string-templates": "2.5.10-alpha.0",
"@budibase/shared-core": "0.0.1",
"@budibase/string-templates": "0.0.1",
"@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -58,10 +58,10 @@
}
},
"dependencies": {
"@budibase/bbui": "2.5.10-alpha.0",
"@budibase/frontend-core": "2.5.10-alpha.0",
"@budibase/shared-core": "2.5.10-alpha.0",
"@budibase/string-templates": "2.5.10-alpha.0",
"@budibase/bbui": "0.0.1",
"@budibase/frontend-core": "0.0.1",
"@budibase/shared-core": "0.0.1",
"@budibase/string-templates": "0.0.1",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "dist/index.js",
"bin": {
@ -29,9 +29,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "2.5.10-alpha.0",
"@budibase/string-templates": "2.5.10-alpha.0",
"@budibase/types": "2.5.10-alpha.0",
"@budibase/backend-core": "0.0.1",
"@budibase/string-templates": "0.0.1",
"@budibase/types": "0.0.1",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,11 +19,11 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "2.5.10-alpha.0",
"@budibase/frontend-core": "2.5.10-alpha.0",
"@budibase/shared-core": "2.5.10-alpha.0",
"@budibase/string-templates": "2.5.10-alpha.0",
"@budibase/types": "2.5.10-alpha.0",
"@budibase/bbui": "0.0.1",
"@budibase/frontend-core": "0.0.1",
"@budibase/shared-core": "0.0.1",
"@budibase/string-templates": "0.0.1",
"@budibase/types": "0.0.1",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -1,13 +1,13 @@
{
"name": "@budibase/frontend-core",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.5.10-alpha.0",
"@budibase/shared-core": "2.5.10-alpha.0",
"@budibase/bbui": "0.0.1",
"@budibase/shared-core": "0.0.1",
"dayjs": "^1.11.7",
"lodash": "^4.17.21",
"socket.io-client": "^4.6.1",

@ -1 +1 @@
Subproject commit 40ebcb2628fa5d90db39d3c8e06c06c7e36dab52
Subproject commit 426d70a73520406a1178f997b4fa1c8bd7c7b186

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -45,12 +45,12 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.5.10-alpha.0",
"@budibase/client": "2.5.10-alpha.0",
"@budibase/pro": "2.5.10-alpha.0",
"@budibase/shared-core": "2.5.10-alpha.0",
"@budibase/string-templates": "2.5.10-alpha.0",
"@budibase/types": "2.5.10-alpha.0",
"@budibase/backend-core": "0.0.1",
"@budibase/client": "0.0.1",
"@budibase/pro": "0.0.1",
"@budibase/shared-core": "0.0.1",
"@budibase/string-templates": "0.0.1",
"@budibase/types": "0.0.1",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/shared-core",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Shared data utils",
"main": "dist/cjs/src/index.js",
"types": "dist/mjs/src/index.d.ts",
@ -20,7 +20,7 @@
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
},
"dependencies": {
"@budibase/types": "2.5.10-alpha.0"
"@budibase/types": "0.0.1"
},
"devDependencies": {
"concurrently": "^7.6.0",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase types",
"main": "dist/cjs/index.js",
"types": "dist/mjs/index.d.ts",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.5.10-alpha.0",
"version": "0.0.1",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -39,10 +39,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.5.10-alpha.0",
"@budibase/pro": "2.5.10-alpha.0",
"@budibase/string-templates": "2.5.10-alpha.0",
"@budibase/types": "2.5.10-alpha.0",
"@budibase/backend-core": "0.0.1",
"@budibase/pro": "0.0.1",
"@budibase/string-templates": "0.0.1",
"@budibase/types": "0.0.1",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

46
scripts/bumpVersion.js Normal file
View File

@ -0,0 +1,46 @@
const fs = require("fs")
const filePath = "lerna.json"
const versionBump = process.argv[2] || "patch"
// Read and parse lerna.json file
const fileData = fs.readFileSync(filePath)
const lernaData = JSON.parse(fileData)
// Get current version and split into major, minor, patch, and alpha components
const currentVersion = lernaData.version
const [versionWithoutPrerelease, alpha] = currentVersion.split("-")
const [major, minor, patch] = versionWithoutPrerelease.split(".").map(Number)
// Calculate new version based on specified version bump
let newVersion = currentVersion
switch (versionBump) {
case "major":
newVersion = `${major + 1}.0.0`
break
case "minor":
newVersion = `${major}.${minor + 1}.0`
break
case "patch":
newVersion = `${major}.${minor}.${patch + 1}`
break
case "alpha":
let newAlphaVersion = 0
if (alpha) {
const [_, alphaVersion] = alpha.split(".")
newAlphaVersion = +alphaVersion + 1
}
newVersion = `${versionWithoutPrerelease}-alpha.${newAlphaVersion}`
break
default:
console.error(`Invalid version bump '${versionBump}' specified.`)
process.exit(1)
}
// Update lerna.json file with new version
lernaData.version = newVersion
const updatedData = JSON.stringify(lernaData, null, 2)
fs.writeFileSync(filePath, updatedData)
console.log(`Updated version from ${currentVersion} to ${newVersion}`)

View File

@ -0,0 +1,53 @@
const fs = require("fs")
const path = require("path")
const { execSync } = require("child_process")
// Get the version argument from the command line
const version = process.argv[2]
if (!version) {
console.error("Usage: node update-workspace-dependencies.js <version>")
process.exit(1)
}
// Get the list of workspaces with mismatched dependencies
const output = execSync("yarn --silent workspaces info --json", {
encoding: "utf-8",
})
const data = JSON.parse(output)
const workspaces = Object.keys(data).filter(key => {
return data[key].mismatchedWorkspaceDependencies?.length
})
// Loop through each workspace and update the dependencies
workspaces.forEach(workspace => {
const dependencies = data[workspace].mismatchedWorkspaceDependencies
// Loop through each dependency and update its version in package.json
const packageJsonPath = path.join(data[workspace].location, "package.json")
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"))
let hasChanges = false
dependencies.forEach(dependency => {
if (packageJson.dependencies?.[dependency]) {
packageJson.dependencies[dependency] = version
hasChanges = true
}
if (packageJson.devDependencies?.[dependency]) {
packageJson.devDependencies[dependency] = version
hasChanges = true
}
if (packageJson.peerDependencies?.[dependency]) {
packageJson.peerDependencies[dependency] = version
hasChanges = true
}
})
// Write changes to package.json if there are any
if (hasChanges) {
fs.writeFileSync(
packageJsonPath,
JSON.stringify(packageJson, null, 2) + "\n"
)
}
})

43
scripts/syncProPackage.js Executable file
View File

@ -0,0 +1,43 @@
const fs = require("fs")
const path = require("path")
const { execSync } = require("child_process")
let version = "0.0.1"
const localPro = fs.existsSync("packages/pro/packages")
if (!localPro) {
const branchName = execSync("git rev-parse --abbrev-ref HEAD")
.toString()
.trim()
if (branchName === "master") {
version = "latest"
} else {
version = "develop"
}
}
// Get the list of workspaces with mismatched dependencies
const output = execSync("yarn --silent workspaces info --json", {
encoding: "utf-8",
})
const data = JSON.parse(output)
// Loop through each workspace and update the dependencies
Object.keys(data).forEach(workspace => {
// Loop through each dependency and update its version in package.json
const packageJsonPath = path.join(data[workspace].location, "package.json")
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"))
let hasChanges = false
if (packageJson.dependencies["@budibase/pro"]) {
packageJson.dependencies["@budibase/pro"] = version
hasChanges = true
}
// Write changes to package.json if there are any
if (hasChanges) {
fs.writeFileSync(
packageJsonPath,
JSON.stringify(packageJson, null, 2) + "\n"
)
}
})

18
scripts/versionCommit.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
if [ -z "$1" ]
then
echo "Error: version number is required. Usage: $0 [major|minor|patch|alpha]"
exit 1
fi
# Bump the version in lerna.json
node scripts/bumpVersion.js $1
NEW_VERSION=$(node -p "require('./lerna.json').version")
git add lerna.json
git commit -m "Bump version to $NEW_VERSION"
git tag v$NEW_VERSION
git push
git push --tags