mirror of
https://github.com/nocodb/nocodb.git
synced 2026-02-02 02:47:29 +00:00
feat: replace v1 workflow files by v2
This commit is contained in:
144
.github/workflows/release-docker-v2.yml
vendored
144
.github/workflows/release-docker-v2.yml
vendored
@@ -1,144 +0,0 @@
|
||||
name: "Release : Docker (v2)"
|
||||
|
||||
on:
|
||||
# Triggered manually
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Docker image tag"
|
||||
required: true
|
||||
targetEnv:
|
||||
description: "Target Environment"
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- DEV
|
||||
- PROD
|
||||
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Docker image tag"
|
||||
required: true
|
||||
type: string
|
||||
targetEnv:
|
||||
description: "Target Environment"
|
||||
required: true
|
||||
type: string
|
||||
isDaily:
|
||||
description: "Is it triggered by daily schedule"
|
||||
required: false
|
||||
type: string
|
||||
currentVersion:
|
||||
description: "The current NocoDB version"
|
||||
required: false
|
||||
type: string
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
working-directory: ./packages/nocodb
|
||||
steps:
|
||||
- name: Get Docker Repository
|
||||
id: get-docker-repository
|
||||
run: |
|
||||
DOCKER_REPOSITORY=nocodb
|
||||
DOCKER_BUILD_TAG=${{ github.event.inputs.tag || inputs.tag }}
|
||||
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 }}
|
||||
fi
|
||||
if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then
|
||||
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily
|
||||
else
|
||||
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely
|
||||
fi
|
||||
fi
|
||||
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}"
|
||||
echo "::set-output name=DOCKER_BUILD_TAG::${DOCKER_BUILD_TAG}"
|
||||
echo ${DOCKER_REPOSITORY}
|
||||
echo ${DOCKER_BUILD_TAG}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.15.0
|
||||
|
||||
- name: upgrade packages for nightly build or pr build
|
||||
if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }}
|
||||
run: |
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js
|
||||
cd packages/nocodb-sdk
|
||||
npm install && npm run build
|
||||
cd ../..
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js &&
|
||||
cd packages/nc-gui-v2
|
||||
npm install
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy
|
||||
cd ../..
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js
|
||||
|
||||
- uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
working-directory: ${{ env.working-directory }}
|
||||
|
||||
- name: Build nocodb and docker files
|
||||
run: |
|
||||
npm run build
|
||||
npm run docker:build
|
||||
working-directory: ${{ env.working-directory }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ${{ env.working-directory }}
|
||||
build-args: NC_VERSION=${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }}
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
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
|
||||
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
3
.github/workflows/release-docker.yml
vendored
3
.github/workflows/release-docker.yml
vendored
@@ -83,7 +83,8 @@ jobs:
|
||||
cd packages/nocodb-sdk
|
||||
npm install && npm run build
|
||||
cd ../..
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js &&
|
||||
cd packages/nc-gui
|
||||
npm install
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy
|
||||
|
||||
93
.github/workflows/release-npm-v2.yml
vendored
93
.github/workflows/release-npm-v2.yml
vendored
@@ -1,93 +0,0 @@
|
||||
name: "Release : NPM packages (v2)"
|
||||
|
||||
on:
|
||||
# Triggered manually
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag"
|
||||
required: true
|
||||
targetEnv:
|
||||
description: "Target Environment"
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- DEV
|
||||
- PROD
|
||||
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag"
|
||||
required: true
|
||||
type: string
|
||||
targetEnv:
|
||||
description: "Target Environment"
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
NPM_TOKEN:
|
||||
required: true
|
||||
# GITHUB_TOKEN:
|
||||
# required: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
working-directory: ./packages/nocodb
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
- name: NPM Setup and Publish with 16.15.0
|
||||
# Setup .npmrc file to publish to npm
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.15.0
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: |
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js &&
|
||||
cd packages/nocodb-sdk &&
|
||||
npm ci && npm run build && npm publish &&
|
||||
cd ../.. &&
|
||||
sleep 60 &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js &&
|
||||
cd packages/nc-gui-v2 &&
|
||||
npm ci &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:publish &&
|
||||
cd ../.. &&
|
||||
sleep 60 &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- name: Create Pull Request
|
||||
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }}
|
||||
id: cpr
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# commit-message: Update report
|
||||
# committer: GitHub <noreply@github.com>
|
||||
# author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
signoff: true
|
||||
branch: 'release/${{ github.event.inputs.tag || inputs.tag }}'
|
||||
delete-branch: true
|
||||
title: 'Release ${{ github.event.inputs.tag || inputs.tag }}'
|
||||
labels: 'Bot: Automerge'
|
||||
- name: Check outputs
|
||||
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }}
|
||||
run: |
|
||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||
- name: automerge
|
||||
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }}
|
||||
uses: "pascalgn/automerge-action@v0.14.3"
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}"
|
||||
MERGE_LABELS: "Bot: Automerge"
|
||||
13
.github/workflows/release-npm.yml
vendored
13
.github/workflows/release-npm.yml
vendored
@@ -30,6 +30,7 @@ on:
|
||||
required: true
|
||||
# GITHUB_TOKEN:
|
||||
# required: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -50,13 +51,14 @@ jobs:
|
||||
- run: |
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js &&
|
||||
cd packages/nocodb-sdk &&
|
||||
npm install && npm run build && npm publish &&
|
||||
npm ci && npm run build && npm publish &&
|
||||
cd ../.. &&
|
||||
sleep 30 &&
|
||||
sleep 60 &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js &&
|
||||
cd packages/nc-gui &&
|
||||
npm install &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:jsdeliver &&
|
||||
npm ci &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:publish &&
|
||||
cd ../.. &&
|
||||
sleep 60 &&
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish
|
||||
@@ -69,9 +71,6 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# commit-message: Update report
|
||||
# committer: GitHub <noreply@github.com>
|
||||
# author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
signoff: true
|
||||
branch: 'release/${{ github.event.inputs.tag || inputs.tag }}'
|
||||
delete-branch: true
|
||||
|
||||
126
.github/workflows/release-pr-v2.yml
vendored
126
.github/workflows/release-pr-v2.yml
vendored
@@ -1,126 +0,0 @@
|
||||
name: 'PR Release (v2)'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# opened: pull request is created
|
||||
# reopened: closed pull request is reopened
|
||||
# synchronize: commit(s) pushed to the pull request
|
||||
# ready_for_review: non PR release
|
||||
types: [opened, reopened, synchronize, ready_for_review]
|
||||
paths:
|
||||
# - "packages/nocodb-sdk/**"
|
||||
- "packages/nc-gui-v2/**"
|
||||
# - "packages/nc-plugin/**"
|
||||
# - "packages/nocodb/**"
|
||||
jobs:
|
||||
# enrich tag for pr release
|
||||
set-tag:
|
||||
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
- name: set-tag
|
||||
id: tag-step
|
||||
run: |
|
||||
# Get current date
|
||||
CURRENT_DATE=$(date +"%Y%m%d")
|
||||
CURRENT_TIME=$(date +"%H%M")
|
||||
# Get current PR number
|
||||
PR_NUMBER=${{github.event.number}}
|
||||
# Get current version
|
||||
CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest))
|
||||
# Construct tag name
|
||||
TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME}
|
||||
echo "::set-output name=TARGET_TAG::${TAG_NAME}"
|
||||
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}"
|
||||
- name: verify-tag
|
||||
run: |
|
||||
echo ${{ steps.tag-step.outputs.TARGET_TAG }}
|
||||
echo ${{ steps.tag-step.outputs.CURRENT_VERSION }}
|
||||
outputs:
|
||||
target_tag: ${{ steps.tag-step.outputs.TARGET_TAG }}
|
||||
current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }}
|
||||
|
||||
# Build, install, publish frontend and backend to npm
|
||||
release-npm:
|
||||
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
|
||||
needs: [set-tag]
|
||||
uses: ./.github/workflows/release-npm-v2.yml
|
||||
with:
|
||||
tag: ${{ needs.set-tag.outputs.target_tag }}
|
||||
targetEnv: 'DEV'
|
||||
secrets:
|
||||
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
# Build docker image and push to docker hub
|
||||
release-docker:
|
||||
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
|
||||
needs: [release-npm, set-tag]
|
||||
uses: ./.github/workflows/release-docker-v2.yml
|
||||
with:
|
||||
currentVersion: ${{ needs.set-tag.outputs.current_version }}
|
||||
tag: ${{ needs.set-tag.outputs.target_tag }}
|
||||
targetEnv: 'DEV'
|
||||
isDaily: 'N'
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
|
||||
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"
|
||||
|
||||
# Build executables and publish to GitHub
|
||||
# release-executables:
|
||||
# if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
|
||||
# needs: [set-tag, release-npm]
|
||||
# uses: ./.github/workflows/release-timely-executables.yml
|
||||
# with:
|
||||
# tag: ${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
|
||||
# secrets:
|
||||
# NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}"
|
||||
|
||||
# Add a comment for PR docker build
|
||||
leave-comment:
|
||||
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
|
||||
runs-on: 'ubuntu-latest'
|
||||
needs: [release-docker, set-tag]
|
||||
steps:
|
||||
- uses: peter-evans/commit-comment@v2
|
||||
with:
|
||||
body: |
|
||||
The PR changes have been deployed. Please run the following command to verify:
|
||||
```
|
||||
docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
|
||||
```
|
||||
|
||||
# Add a comment for PR executable build
|
||||
# leave-executable-comment:
|
||||
# if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }}
|
||||
# runs-on: 'ubuntu-latest'
|
||||
# needs: [release-executables, set-tag]
|
||||
# steps:
|
||||
# - uses: peter-evans/commit-comment@v2
|
||||
# with:
|
||||
# body: |
|
||||
# ### Run Executables
|
||||
|
||||
# #### MacOS
|
||||
|
||||
# ```bash
|
||||
# mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \
|
||||
# && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-macos-arm64 -o noco -L \
|
||||
# && chmod +x noco \
|
||||
# && ./noco
|
||||
# ```
|
||||
# #### Linux
|
||||
|
||||
# ```bash
|
||||
# mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \
|
||||
# && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-linux-x64 -o noco -L \
|
||||
# && chmod +x noco \
|
||||
# && ./noco
|
||||
# ```
|
||||
# #### Windows
|
||||
|
||||
# ```bash
|
||||
# iwr http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-win-arm64.exe
|
||||
# .\Noco-win-arm64.exe
|
||||
# ```
|
||||
|
||||
# For executables visit [here](https://github.com/nocodb/nocodb-timely/releases/tag/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }})
|
||||
@@ -9,8 +9,8 @@
|
||||
"test": "vitest -c test/vite.config.ts",
|
||||
"test:ui": "vitest -c test/vite.config.ts --ui",
|
||||
"coverage": "vitest -c test/vite.config.ts run --coverage",
|
||||
"build:copy": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/",
|
||||
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/; npm publish ../nc-lib-gui-v2",
|
||||
"build:copy": "npm run generate; rm -rf ../nc-lib-gui/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui/lib/dist/",
|
||||
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui/lib/dist/; npm publish ../nc-lib-gui",
|
||||
"postinstall": "node scripts/updateNuxtRouting.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), 'utf8'))
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui', 'package.json'), 'utf8'))
|
||||
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// nightly build
|
||||
@@ -13,4 +13,4 @@ if (process.env.targetEnv === 'DEV') {
|
||||
} else {
|
||||
packageJson.version = process.env.targetVersion
|
||||
}
|
||||
fs.writeFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), JSON.stringify(packageJson, 0, 2))
|
||||
fs.writeFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui', 'package.json'), JSON.stringify(packageJson, 0, 2))
|
||||
@@ -2,10 +2,6 @@ const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'), 'utf8'))
|
||||
const version = packageJson.version
|
||||
.replace(/\.(\d+)$/, (_, v) => {
|
||||
return `.${++v}`
|
||||
})
|
||||
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// nightly build
|
||||
|
||||
@@ -46,4 +46,4 @@ if (process.env.targetEnv === 'DEV') {
|
||||
})
|
||||
} else {
|
||||
bumbVersionAndSave();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
// extract latest version from package.json
|
||||
const ncLibPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json')))
|
||||
|
||||
|
||||
const replacePackageName = (filePath) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return fs.readFile(filePath, 'utf8', function (err, data) {
|
||||
if (err) return reject(err)
|
||||
var result = data.replace(/nc-lib-gui-v2/g, ncLibPackage.name);
|
||||
return fs.writeFile(filePath, result, 'utf8', function (err) {
|
||||
if (err) return reject(err)
|
||||
return resolve()
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
const bumbVersionAndSave = () => {
|
||||
// upgrade nc-lib-gui-v2 version in nocodb
|
||||
execSync(`cd packages/nocodb && npm install --save --save-exact ${ncLibPackage.name}@${ncLibPackage.version}`, {});
|
||||
const nocodbPackageFilePath = path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
|
||||
const nocoLibPackage = JSON.parse(fs.readFileSync(nocodbPackageFilePath))
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
nocoLibPackage.name = `${nocoLibPackage.name}-daily`
|
||||
}
|
||||
nocoLibPackage.version = ncLibPackage.version
|
||||
fs.writeFileSync(nocodbPackageFilePath, JSON.stringify(nocoLibPackage, null, 2));
|
||||
}
|
||||
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// replace nc-lib-gui-v2 by nc-lib-gui-v2-daily if it is nightly build / pr release
|
||||
const filePaths = [
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'Dockerfile'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'litestream', 'Dockerfile'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'README.md'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'src', 'lib', 'Noco.ts'),
|
||||
]
|
||||
Promise.all(filePaths.map(filePath => { return replacePackageName(filePath) })).then(() => {
|
||||
bumbVersionAndSave();
|
||||
})
|
||||
} else {
|
||||
bumbVersionAndSave();
|
||||
}
|
||||
@@ -29,6 +29,7 @@ const dfs = function(dir) {
|
||||
var res = [];
|
||||
var list = fs.readdirSync(dir);
|
||||
list.forEach(function(file) {
|
||||
if (['node_modules', 'build'].includes(file)) return;
|
||||
file = dir + '/' + file;
|
||||
var stat = fs.statSync(file);
|
||||
if (stat && stat.isDirectory()) {
|
||||
@@ -44,10 +45,9 @@ const dfs = function(dir) {
|
||||
}
|
||||
|
||||
const searchAndReplace = (target) => {
|
||||
const dirPath = path.resolve(path.join(__dirname, '..', 'packages'))
|
||||
let list = dfs(dirPath)
|
||||
list = [
|
||||
...list,
|
||||
let list = [
|
||||
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nc-gui'))),
|
||||
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nocodb'))),
|
||||
path.join(__dirname, '..', 'packages', 'nc-gui', 'package.json'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
|
||||
]
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path');
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
// extract latest version from package.json
|
||||
const nocodbSdkPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'), 'utf8'))
|
||||
|
||||
const replacePackageName = (filePath) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return fs.readFile(filePath, 'utf8', function (err, data) {
|
||||
if (err) return reject(err)
|
||||
var result = data.replace(/nocodb-sdk/g, nocodbSdkPackage.name);
|
||||
return fs.writeFile(filePath, result, 'utf8', function (err) {
|
||||
if (err) return reject(err)
|
||||
return resolve()
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
const bumbVersionAndSave = () => {
|
||||
// upgrade nocodb-sdk version in nocodb
|
||||
execSync(`cd packages/nocodb && npm install --save --save-exact ${nocodbSdkPackage.name}@${nocodbSdkPackage.version}`, {});
|
||||
// upgrade nocodb-sdk version in nc-gui-v2
|
||||
execSync(`cd packages/nc-gui-v2 && npm install --save --save-exact ${nocodbSdkPackage.name}@${nocodbSdkPackage.version}`, {});
|
||||
}
|
||||
|
||||
const dfs = function(dir) {
|
||||
var res = [];
|
||||
var list = fs.readdirSync(dir);
|
||||
list.forEach(function(file) {
|
||||
if (['node_modules', 'build'].includes(file)) return;
|
||||
file = dir + '/' + file;
|
||||
var stat = fs.statSync(file);
|
||||
if (stat && stat.isDirectory()) {
|
||||
res = res.concat(dfs(file));
|
||||
} else {
|
||||
const ext = path.extname(file).toLowerCase()
|
||||
if (ext == '.vue' || ext == '.ts' || ext == '.js') {
|
||||
res.push(file);
|
||||
}
|
||||
}
|
||||
})
|
||||
return res;
|
||||
}
|
||||
|
||||
const searchAndReplace = (target) => {
|
||||
let list = [
|
||||
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nc-gui-v2'))),
|
||||
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nocodb'))),
|
||||
path.join(__dirname, '..', 'packages', 'nc-gui-v2', 'package.json'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
|
||||
]
|
||||
return Promise.all(list.map(d => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(d, function(err, content) {
|
||||
if (err) reject(err)
|
||||
if (content.indexOf(target) > -1) {
|
||||
resolve(replacePackageName(d))
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// replace nocodb-sdk by nocodb-sdk-daily if it is nightly build / pr build
|
||||
searchAndReplace('nocodb-sdk')
|
||||
.then(() => {
|
||||
bumbVersionAndSave()
|
||||
})
|
||||
} else {
|
||||
bumbVersionAndSave()
|
||||
}
|
||||
Reference in New Issue
Block a user