diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 2f19829129..adc17aacee 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -50,6 +50,10 @@ jobs: run: | DOCKER_REPOSITORY=nocodb DOCKER_BUILD_TAG=${{ github.event.inputs.tag || inputs.tag }} + DOCKER_BUILD_LATEST_TAG=latest + if [[ "$DOCKER_BUILD_TAG" =~ "-beta." ]]; then + DOCKER_BUILD_LATEST_TAG=$(echo $DOCKER_BUILD_TAG | awk -F '-beta.' '{print $1}')-beta.latest + fi if [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then if [[ ${{ github.event.inputs.currentVersion || inputs.currentVersion || 'N/A' }} != 'N/A' ]]; then DOCKER_BUILD_TAG=${{ github.event.inputs.currentVersion || inputs.currentVersion }}-${{ github.event.inputs.tag || inputs.tag }} @@ -62,8 +66,10 @@ jobs: fi echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_OUTPUT echo "DOCKER_BUILD_TAG=${DOCKER_BUILD_TAG}" >> $GITHUB_OUTPUT + echo "DOCKER_BUILD_LATEST_TAG=${DOCKER_BUILD_LATEST_TAG}" >> $GITHUB_OUTPUT echo DOCKER_REPOSITORY: ${DOCKER_REPOSITORY} echo DOCKER_BUILD_TAG: ${DOCKER_BUILD_TAG} + echo DOCKER_BUILD_LATEST_TAG: ${DOCKER_BUILD_LATEST_TAG} - name: Checkout uses: actions/checkout@v3 @@ -134,7 +140,7 @@ jobs: push: true tags: | nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }} - nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:latest + nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_LATEST_TAG }} # Temp fix # https://github.com/docker/build-push-action/issues/252 diff --git a/packages/nc-gui/components/general/ReleaseInfo.vue b/packages/nc-gui/components/general/ReleaseInfo.vue index 14d9a3a595..058262417f 100644 --- a/packages/nc-gui/components/general/ReleaseInfo.vue +++ b/packages/nc-gui/components/general/ReleaseInfo.vue @@ -7,6 +7,9 @@ const { currentVersion, latestRelease, hiddenRelease } = useGlobal() const releaseAlert = computed({ get() { + if (currentVersion.value?.includes('-beta.') || latestRelease.value?.includes('-beta.')) { + return false + } return ( currentVersion.value && latestRelease.value && @@ -22,7 +25,7 @@ const releaseAlert = computed({ async function fetchReleaseInfo() { try { const versionInfo = await $api.utils.appVersion() - if (versionInfo && versionInfo.releaseVersion && versionInfo.currentVersion && !/[^0-9.]/.test(versionInfo.currentVersion)) { + if (versionInfo && versionInfo.releaseVersion && versionInfo.currentVersion) { currentVersion.value = versionInfo.currentVersion latestRelease.value = versionInfo.releaseVersion } else { diff --git a/packages/noco-docs/content/en/engineering/builds-and-releases.md b/packages/noco-docs/content/en/engineering/builds-and-releases.md index 93273cd0e8..c5d362afe6 100644 --- a/packages/noco-docs/content/en/engineering/builds-and-releases.md +++ b/packages/noco-docs/content/en/engineering/builds-and-releases.md @@ -6,7 +6,9 @@ category: "Engineering" menuTitle: "Releases & Builds" --- ## Builds of NocoDB + There are 3 kinds of docker builds in NocoDB + - Release builds [nocodb/nocodb](https://hub.docker.com/r/nocodb/nocodb) : built during NocoDB release. - Daily builds [nocodb/nocodb-daily](https://hub.docker.com/r/nocodb/nocodb-daily) : built every 6 hours from Develop branch. - Daily builds [nocodb/nocodb-timely](https://hub.docker.com/r/nocodb/nocodb-timely): built for every PR. @@ -26,12 +28,24 @@ Below is an overview of how to make these builds and what happens behind the sce ![image](https://user-images.githubusercontent.com/35857179/167240383-dda05f76-8323-4f4a-b3e7-9db886dbd68d.png) - Then there would be two cases - you can either leave target tag and pervious tag blank or manually input some values -> Target Tag means the target deployment version, while Previous Tag means the latest version as of now. Previous Tag is used for Release Note only - showing the file / commit differences between two tags. +- Target Tag means the target deployment version, while Previous Tag means the latest version as of now. Previous Tag is used for Release Note only - showing the file / commit differences between two tags. + +### Tagging + +The naming convention would be following given the actual release tag is `0.100.0` + +- `0.100.0-beta.1` (first version of pre-release) +- `0.100.0-beta.2` (include bug fix changes on top of the previous version) +- `0.100.0-beta.3`(include bug fix changes on top of the previous version) +- and so on ... +- `0.100.0` (actual release) +- `0.100.1` (minor bug fix release) +- `0.100.2` (minor bug fix release) ### Case 1: Leaving inputs blank - If Previous Tag is blank, then the value will be fetched from [latest](https://github.com/nocodb/nocodb/releases/latest) -- If Target Tag is blank, then the value will be Previous Tag plus one. Example: 0.90.11 (Previous Tag) + 1 = 0.90.12 (Target Tag) +- If Target Tag is blank, then the value will be Previous Tag plus one. Example: 0.90.11 (Previous Tag) + 0.0.1 = 0.90.12 (Target Tag) ### Case 2: Manually Input diff --git a/packages/nocodb/package-lock.json b/packages/nocodb/package-lock.json index 6efa3fe845..3b8d492b72 100644 --- a/packages/nocodb/package-lock.json +++ b/packages/nocodb/package-lock.json @@ -23,6 +23,7 @@ "bullmq": "^1.81.1", "clear": "^0.1.0", "colors": "1.4.0", + "compare-versions": "^5.0.1", "cookie-parser": "^1.4.5", "cors": "^2.8.5", "cron": "^1.8.2", @@ -3810,6 +3811,11 @@ "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, + "node_modules/compare-versions": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-5.0.1.tgz", + "integrity": "sha512-v8Au3l0b+Nwkp4G142JcgJFh1/TUhdxut7wzD1Nq1dyp5oa3tXaqb03EXOAB6jS4gMlalkjAUPZBMiAfKUixHQ==" + }, "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -20757,6 +20763,11 @@ "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, + "compare-versions": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-5.0.1.tgz", + "integrity": "sha512-v8Au3l0b+Nwkp4G142JcgJFh1/TUhdxut7wzD1Nq1dyp5oa3tXaqb03EXOAB6jS4gMlalkjAUPZBMiAfKUixHQ==" + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json index a421d41fe6..e6883c00df 100644 --- a/packages/nocodb/package.json +++ b/packages/nocodb/package.json @@ -63,6 +63,7 @@ "bullmq": "^1.81.1", "clear": "^0.1.0", "colors": "1.4.0", + "compare-versions": "^5.0.1", "cookie-parser": "^1.4.5", "cors": "^2.8.5", "cron": "^1.8.2", diff --git a/packages/nocodb/src/lib/meta/api/utilApis.ts b/packages/nocodb/src/lib/meta/api/utilApis.ts index cdd9f0a321..16cee5adcb 100644 --- a/packages/nocodb/src/lib/meta/api/utilApis.ts +++ b/packages/nocodb/src/lib/meta/api/utilApis.ts @@ -1,5 +1,6 @@ // // Project CRUD import { Request, Response } from 'express'; +import { compareVersions, validate } from 'compare-versions'; import { ViewTypes } from 'nocodb-sdk'; import Project from '../../models/Project'; @@ -65,17 +66,22 @@ export async function versionInfo(_req: Request, res: Response) { (versionCache.lastFetched && versionCache.lastFetched < Date.now() - 1000 * 60 * 60) ) { - versionCache.releaseVersion = await axios - .get('https://github.com/nocodb/nocodb/releases/latest', { + const nonBetaTags = await axios + .get('https://api.github.com/repos/nocodb/nocodb/tags', { timeout: 5000, }) - .then((response) => - response.request.res.responseUrl.replace( - 'https://github.com/nocodb/nocodb/releases/tag/', - '' - ) - ) + .then((response) => { + return response.data + .map((x) => x.name) + .filter( + (v) => validate(v) && !v.includes('finn') && !v.includes('beta') + ) + .sort((x, y) => compareVersions(y, x)); + }) .catch(() => null); + if (nonBetaTags && nonBetaTags.length > 0) { + versionCache.releaseVersion = nonBetaTags[0]; + } versionCache.lastFetched = Date.now(); }