diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index b351d6edbf..eb9eeebb37 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -42,15 +42,3 @@ jobs: name: codecov-umbrella verbose: true - run: yarn test:e2e:ci - - - name: Build and Push Development Docker Image - # Only run on push - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }} - run: | - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD - yarn build - yarn build:docker:develop - env: - DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} - diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml new file mode 100644 index 0000000000..ce41fcc3e6 --- /dev/null +++ b/.github/workflows/release-develop.yml @@ -0,0 +1,52 @@ +name: Budibase Release Staging + +on: + push: + branches: + - develop + +env: + POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} + POSTHOG_URL: ${{ secrets.POSTHOG_URL }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: yarn + - run: yarn bootstrap + - run: yarn lint + - run: yarn build + - run: yarn test + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + + - name: Publish budibase packages to NPM + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + # setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default + git config user.name "Budibase Staging Release Bot" + git config user.email "<>" + echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc + yarn release:develop + + - name: Build/release Docker images + run: | + docker login -u $DOCKER_USER -p $DOCKER_PASSWORD + yarn build + yarn build:docker:develop + env: + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} diff --git a/lerna.json b/lerna.json index 27fbed5858..dd2d7c4e0a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.78", + "version": "0.9.79-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/package.json b/package.json index 61ff67b076..4f545d935f 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "publishdev": "lerna run publishdev", "publishnpm": "yarn build && lerna publish --force-publish", "release": "yarn build && lerna publish patch --yes --force-publish", + "release:develop": "yarn build && lerna publish prerelease --yes --force-publish --dist-tag develop", "restore": "yarn run clean && yarn run bootstrap && yarn run build", "nuke": "yarn run nuke:packages && yarn run nuke:docker", "nuke:packages": "yarn run restore", diff --git a/packages/auth/package.json b/packages/auth/package.json index 6ad144687a..687005e7f0 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", @@ -10,6 +10,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { + "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.901.0", "bcryptjs": "^2.4.3", "ioredis": "^4.27.1", @@ -17,7 +18,6 @@ "koa-passport": "^4.1.4", "lodash": "^4.17.21", "node-fetch": "^2.6.1", - "@techpass/passport-openidconnect": "^0.3.0", "passport-google-auth": "^1.0.2", "passport-google-oauth": "^2.0.0", "passport-jwt": "^4.0.0", @@ -35,8 +35,8 @@ "devDependencies": { "ioredis-mock": "^5.5.5", "jest": "^26.6.3", - "pouchdb-adapter-memory": "^7.2.2", "pouchdb": "^7.2.1", + "pouchdb-adapter-memory": "^7.2.2", "pouchdb-all-dbs": "^1.0.2" }, "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc" diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 5e11c19012..bcb08a577d 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index aa6b165731..21735ba9db 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.78", - "@budibase/client": "^0.9.78", + "@budibase/bbui": "^0.9.79-alpha.3", + "@budibase/client": "^0.9.79-alpha.3", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.78", + "@budibase/string-templates": "^0.9.79-alpha.3", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/pages/builder/portal/manage/auth/index.svelte b/packages/builder/src/pages/builder/portal/manage/auth/index.svelte index 2ca0f7e2e8..7527343ba9 100644 --- a/packages/builder/src/pages/builder/portal/manage/auth/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/auth/index.svelte @@ -232,6 +232,10 @@ } originalGoogleDoc = cloneDeep(googleDoc) } else { + // default activated to true for older configs + if (googleDoc.config.activated === undefined) { + googleDoc.config.activated = true + } originalGoogleDoc = cloneDeep(googleDoc) providers.google = googleDoc } diff --git a/packages/cli/package.json b/packages/cli/package.json index bb0dac5262..a3dafcaefb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 5c75abd6b8..5a8ba1e096 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.78", - "@budibase/standard-components": "^0.9.78", - "@budibase/string-templates": "^0.9.78", + "@budibase/bbui": "^0.9.79-alpha.3", + "@budibase/standard-components": "^0.9.79-alpha.3", + "@budibase/string-templates": "^0.9.79-alpha.3", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index d3a2eea138..8d2a12b773 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -60,9 +60,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.78", - "@budibase/client": "^0.9.78", - "@budibase/string-templates": "^0.9.78", + "@budibase/auth": "^0.9.79-alpha.3", + "@budibase/client": "^0.9.79-alpha.3", + "@budibase/string-templates": "^0.9.79-alpha.3", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -115,7 +115,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.78", + "@budibase/standard-components": "^0.9.79-alpha.3", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/server/src/api/routes/tests/misc.spec.js b/packages/server/src/api/routes/tests/misc.spec.js index 04a5c62431..b1dd683060 100644 --- a/packages/server/src/api/routes/tests/misc.spec.js +++ b/packages/server/src/api/routes/tests/misc.spec.js @@ -31,7 +31,13 @@ describe("run misc tests", () => { describe("/version", () => { it("should confirm version", async () => { const res = await request.get("/version").expect(200) - expect(res.text.split(".").length).toEqual(3) + const text = res.text + if (text.includes("alpha")) { + expect(text.split(".").length).toEqual(4) + } else { + expect(text.split(".").length).toEqual(3) + } + }) }) diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 0b7a7b9d57..a9764563ab 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,12 +29,12 @@ "keywords": [ "svelte" ], - "version": "0.9.78", + "version": "0.9.79-alpha.3", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { + "@budibase/bbui": "^0.9.79-alpha.3", "@spectrum-css/card": "^3.0.3", - "@budibase/bbui": "^0.9.78", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", "@spectrum-css/typography": "^3.0.2", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b120864673..f93e69b59a 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index c50a6bf096..f55b8de669 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.78", + "version": "0.9.79-alpha.3", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,9 +21,10 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.78", - "@budibase/string-templates": "^0.9.78", + "@budibase/auth": "^0.9.79-alpha.3", + "@budibase/string-templates": "^0.9.79-alpha.3", "@koa/router": "^8.0.0", + "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", "dotenv": "^8.2.0", @@ -39,7 +40,6 @@ "koa-static": "^5.0.0", "node-fetch": "^2.6.1", "nodemailer": "^6.5.0", - "@techpass/passport-openidconnect": "^0.3.0", "passport-google-oauth": "^2.0.0", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", diff --git a/packages/worker/src/api/controllers/global/auth.js b/packages/worker/src/api/controllers/global/auth.js index f576e697ea..1275084687 100644 --- a/packages/worker/src/api/controllers/global/auth.js +++ b/packages/worker/src/api/controllers/global/auth.js @@ -9,6 +9,7 @@ const { Cookies } = authPkg.constants const { passport } = authPkg.auth const { checkResetPasswordCode } = require("../../../utilities/redis") const { getGlobalDB } = authPkg.db +const env = require("../../../environment") function googleCallbackUrl(tenantId = null) { let callbackUrl = `/api/global/auth` @@ -158,11 +159,13 @@ async function oidcStrategyFactory(ctx, configId) { const chosenConfig = config.configs.filter(c => c.uuid === configId)[0] - let callbackUrl = `${ctx.protocol}://${ctx.host}/api/global/auth` + const protocol = env.NODE_ENV === "production" ? "https" : "http" + let callbackUrl = `${protocol}://${ctx.host}/api/global/auth` if (tenantId) { callbackUrl += `/${tenantId}` } callbackUrl += `/oidc/callback` + return oidc.strategyFactory(chosenConfig, callbackUrl) } diff --git a/packages/worker/src/api/controllers/global/configs.js b/packages/worker/src/api/controllers/global/configs.js index cd79d7f95b..7cd03c728a 100644 --- a/packages/worker/src/api/controllers/global/configs.js +++ b/packages/worker/src/api/controllers/global/configs.js @@ -145,12 +145,22 @@ exports.publicSettings = async function (ctx) { config = publicConfig } - config.config.google = !googleConfig - ? !!googleConfig - : googleConfig.config.activated - config.config.oidc = !oidcConfig - ? !!oidcConfig - : oidcConfig.config.configs[0].activated + // google button flag + if (googleConfig && googleConfig.config) { + // activated by default for configs pre-activated flag + config.config.google = googleConfig.config.activated == null || + googleConfig.config.activated + } else { + config.config.google = false + } + + // oidc button flag + if (oidcConfig && oidcConfig.config) { + config.config.oidc = oidcConfig.config.configs[0].activated + } else { + config.config.oidc = false + } + ctx.body = config } catch (err) { ctx.throw(err.status, err) diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index 7c631bf86d..c42bc087e8 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -17,6 +17,7 @@ if (!LOADED && isDev() && !isTest()) { } module.exports = { + NODE_ENV: process.env.NODE_ENV, SELF_HOSTED: process.env.SELF_HOSTED, PORT: process.env.PORT, CLUSTER_PORT: process.env.CLUSTER_PORT,