mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 03:45:41 +00:00
20
.github/workflows/release-docker.yml
vendored
20
.github/workflows/release-docker.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
options:
|
||||
- DEV
|
||||
- PROD
|
||||
# Triggered by release-nocodb.yml / release-nightly-dev.yml
|
||||
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
@@ -48,9 +48,9 @@ jobs:
|
||||
id: get-docker-repository
|
||||
run: |
|
||||
DOCKER_REPOSITORY=nocodb
|
||||
REF_BRANCH=master
|
||||
if [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then
|
||||
REF_BRANCH=develop
|
||||
if [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'PR' ]]; then
|
||||
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely
|
||||
elif [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then
|
||||
if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then
|
||||
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily
|
||||
else
|
||||
@@ -58,23 +58,21 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}"
|
||||
echo "::set-output name=REF_BRANCH::${REF_BRANCH}"
|
||||
echo ${DOCKER_REPOSITORY}
|
||||
# - name: Verify
|
||||
# run : |
|
||||
# echo ${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ steps.get-docker-repository.outputs.REF_BRANCH }}
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: upgrade packages for nightly build
|
||||
if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }}
|
||||
- name: upgrade packages for nightly build or pr build
|
||||
if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' || github.event.inputs.targetEnv == 'PR' || inputs.targetEnv == 'PR' }}
|
||||
run: |
|
||||
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js
|
||||
cd packages/nocodb-sdk
|
||||
|
||||
3
.github/workflows/release-npm.yml
vendored
3
.github/workflows/release-npm.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
options:
|
||||
- DEV
|
||||
- PROD
|
||||
# Triggered by release-nocodb.yml / release-nightly-dev.yml
|
||||
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
@@ -83,6 +83,7 @@ jobs:
|
||||
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 }}"
|
||||
|
||||
99
.github/workflows/release-pr.yml
vendored
Normal file
99
.github/workflows/release-pr.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
name: 'PR Release'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# opened: pull request is created
|
||||
# reopened: closed pull request is reopened
|
||||
# synchronize: commit(s) pushed to the pull request
|
||||
types: [opened, reopened, synchronize]
|
||||
paths:
|
||||
- "packages/nocodb-sdk/**"
|
||||
- "packages/nc-gui/**"
|
||||
- "packages/nc-plugin/**"
|
||||
- "packages/nocodb/**"
|
||||
jobs:
|
||||
# Validate Branch
|
||||
validate-branch:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
if [[ ${{ github.base_ref }} != 'develop' ]]; then
|
||||
echo "PR Release only runs on develop as a base branch"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# enrich tag for pr release
|
||||
set-tag:
|
||||
runs-on: 'ubuntu-latest'
|
||||
needs: [validate-branch]
|
||||
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:
|
||||
needs: [set-tag]
|
||||
uses: ./.github/workflows/release-npm.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:
|
||||
needs: [release-npm, set-tag]
|
||||
uses: ./.github/workflows/release-docker.yml
|
||||
with:
|
||||
tag: ${{ needs.set-tag.outputs.target_tag }}
|
||||
targetEnv: 'PR'
|
||||
isDaily: 'N'
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
|
||||
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"
|
||||
|
||||
leave-comment:
|
||||
runs-on: 'ubuntu-latest'
|
||||
needs: [release-docker, set-tag]
|
||||
steps:
|
||||
- run: |
|
||||
echo docker run -d -p 8888:8080 nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
|
||||
|
||||
# Uncomment it after testing
|
||||
# leave-comment:
|
||||
# runs-on: 'ubuntu-latest'
|
||||
# needs: [release-docker, set-tag]
|
||||
# steps:
|
||||
# - uses: peter-evans/commit-comment@v2
|
||||
# with:
|
||||
# body: |
|
||||
# The PR changes have been deployed. Pleae run the following command to verify:
|
||||
# ```
|
||||
# docker run -d -p 8888:8080 nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}
|
||||
# ```
|
||||
|
||||
# if-merged:
|
||||
# if: github.event.pull_request.merged == true
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - run: |
|
||||
# echo The PR was merged
|
||||
@@ -10,6 +10,8 @@ const version = packageJson.version
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// nightly build
|
||||
// e.g. 0.84.2-20220220-1250
|
||||
// pr build
|
||||
// e.g. 0.84.2-pr-1234-20220220-1250
|
||||
packageJson.version = `${packageJson.version}-${process.env.targetVersion}`
|
||||
packageJson.name += '-daily'
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ const bumbVersionAndSave = () => {
|
||||
}
|
||||
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// replace nc-lib-gui by nc-lib-gui-daily if it is nightly build
|
||||
// replace nc-lib-gui by nc-lib-gui-daily if it is nightly build / pr release
|
||||
const filePaths = [
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'Dockerfile'),
|
||||
path.join(__dirname, '..', 'packages', 'nocodb', 'litestream', 'Dockerfile'),
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path');
|
||||
const { mainModule } = require('process');
|
||||
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
// extract latest version from package.json
|
||||
@@ -68,7 +66,7 @@ const searchAndReplace = (target) => {
|
||||
}
|
||||
|
||||
if (process.env.targetEnv === 'DEV') {
|
||||
// replace nocodb-sdk by nocodb-sdk-daily if it is nightly build
|
||||
// replace nocodb-sdk by nocodb-sdk-daily if it is nightly build / pr build
|
||||
searchAndReplace('nocodb-sdk')
|
||||
.then(() => {
|
||||
bumbVersionAndSave()
|
||||
|
||||
Reference in New Issue
Block a user