Merge branch 'main' into next
Some checks are pending
Build docker image / build-and-push (push) Waiting to run
Build pro image / get-plugins (push) Waiting to run
Build pro image / build-and-push (push) Blocked by required conditions
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase backend test / sqlite-test (20, false) (push) Waiting to run
NocoBase backend test / sqlite-test (20, true) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase backend test / mysql-test (20, false) (push) Waiting to run
NocoBase backend test / mysql-test (20, true) (push) Waiting to run
NocoBase backend test / mariadb-test (20, false) (push) Waiting to run
NocoBase backend test / mariadb-test (20, true) (push) Waiting to run
NocoBase frontEnd test / frontend-test (20) (push) Waiting to run
Test on Windows / build (push) Waiting to run

This commit is contained in:
nocobase[bot] 2024-11-19 08:45:04 +00:00
commit 8e0022c69e
13 changed files with 372 additions and 137 deletions

View File

@ -9,6 +9,7 @@ on:
branches:
- 'main'
- 'next'
- 'develop'
paths:
- 'packages/**'
- 'Dockerfile.pro'
@ -16,9 +17,13 @@ on:
- '.github/workflows/build-pro-image.yml'
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
build-and-push:
if: github.event.pull_request.head.repo.fork != true
runs-on: ubuntu-latest
needs: get-plugins
services:
verdaccio:
image: verdaccio/verdaccio:5
@ -28,10 +33,12 @@ jobs:
- name: Get pro plugins
id: get-pro-plugins
run: |
if [[ "${{ github.head_ref || github.ref_name }}" == "main" ]]; then
echo "proRepos=$(echo '${{ vars.PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
if [[ "${{ github.head_ref || github.ref_name }}" == "next" ]]; then
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.beta-plugins }}')" >> $GITHUB_OUTPUT
elif [[ "${{ github.head_ref || github.ref_name }}" == "develop" ]]; then
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.alpha-plugins }}')" >> $GITHUB_OUTPUT
else
echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.rc-plugins }}')" >> $GITHUB_OUTPUT
fi
- uses: actions/create-github-app-token@v1
id: app-token

View File

@ -11,29 +11,38 @@ on:
type: choice
description: Please choose a version
options:
- rc
- beta
- alpha
default: beta
default: rc
push:
tags:
- 'v*'
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
write-changelog-and-release:
needs: get-plugins
runs-on: ubuntu-latest
steps:
- name: Get info
id: get-info
shell: bash
run: |
if [[ "${{ inputs.version }}" == "alpha" || ${{ github.ref_name }} =~ "alpha" ]]; then
if [[ "${{ inputs.version }}" == "beta" || ${{ github.ref_name }} =~ "beta" ]]; then
echo "branch=$(echo 'next')" >> $GITHUB_OUTPUT
echo "version=$(echo 'beta')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.beta-plugins }}')" >> $GITHUB_OUTPUT
elif [[ "${{ inputs.version }}" == "alpha" || ${{ github.ref_name }} =~ "alpha" ]]; then
echo "branch=$(echo 'develop')" >> $GITHUB_OUTPUT
echo "version=$(echo 'alpha')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.alpha-plugins }}')" >> $GITHUB_OUTPUT
else
echo "branch=$(echo 'main')" >> $GITHUB_OUTPUT
echo "version=$(echo 'beta')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ vars.PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
echo "version=$(echo 'rc')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.rc-plugins }}')" >> $GITHUB_OUTPUT
fi
- uses: actions/create-github-app-token@v1
id: app-token
@ -89,7 +98,7 @@ jobs:
PRO_PLUGIN_REPOS: ${{ steps.get-info.outputs.proRepos }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Commit and push
if: ${{ steps.get-info.outputs.version == 'beta' }}
if: ${{ steps.get-info.outputs.version == 'rc' }}
run: |
git pull origin main
git add .

View File

@ -27,8 +27,14 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,plugin-workflow-approval
skip-token-revoke: true
- uses: actions/checkout@v4
- name: Checkout pro-plugins
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
uses: actions/checkout@v4
@ -37,7 +43,16 @@ jobs:
ref: main
path: packages/pro-plugins
fetch-depth: 0
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }}
token: ${{ steps.app-token.outputs.token }}
- name: Checkout plugin-workflow-approval
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
uses: actions/checkout@v4
with:
repository: nocobase/plugin-workflow-approval
ref: main
path: packages/pro-plugins/@nocobase/plugin-workflow-approval
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- run: |
cd packages/pro-plugins &&
if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then
@ -49,6 +64,18 @@ jobs:
git checkout main
fi
fi
cd ../../
cd packages/pro-plugins/@nocobase/plugin-workflow-approval &&
if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then
git checkout ${{ github.head_ref || github.ref_name }}
else
if git show-ref --quiet refs/remotes/origin/${{ github.event.pull_request.base.ref }}; then
git checkout ${{ github.event.pull_request.base.ref }}
else
git checkout main
fi
fi
cd ../../../../
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
- name: Git logs
run: |
@ -290,7 +317,23 @@ jobs:
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,plugin-workflow-approval
skip-token-revoke: true
- uses: actions/checkout@v4
- name: Checkout pro-plugins
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
uses: actions/checkout@v4
with:
repository: nocobase/pro-plugins
ref: main
path: packages/pro-plugins
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Checkout plugin-workflow-approval
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
uses: actions/checkout@v4
@ -299,7 +342,7 @@ jobs:
ref: main
path: packages/pro-plugins/@nocobase/plugin-workflow-approval
fetch-depth: 0
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }}
token: ${{ steps.app-token.outputs.token }}
- run: |
cd packages/pro-plugins &&
if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then
@ -311,10 +354,22 @@ jobs:
git checkout main
fi
fi
cd ../../
cd packages/pro-plugins/@nocobase/plugin-workflow-approval &&
if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then
git checkout ${{ github.head_ref || github.ref_name }}
else
if git show-ref --quiet refs/remotes/origin/${{ github.event.pull_request.base.ref }}; then
git checkout ${{ github.event.pull_request.base.ref }}
else
git checkout main
fi
fi
cd ../../../../
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
- name: Git logs
run: |
cd packages/pro-plugins && git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 10
cd packages/pro-plugins/@nocobase/plugin-workflow-approval && git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 10
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
- name: Set variables
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true

View File

@ -15,9 +15,13 @@ on:
description: 'Please enter the pr number of nocobase/nocobase repository'
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
build-and-push:
if: github.event.pull_request.head.repo.fork != true
runs-on: ubuntu-latest
needs: get-plugins
services:
verdaccio:
image: verdaccio/verdaccio:latest
@ -27,12 +31,15 @@ jobs:
- name: Get pro plugins
id: get-info
run: |
if [[ "${{ github.head_ref || github.ref_name }}" == "main" ]]; then
echo "proRepos=$(echo '${{ vars.PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
echo "branch=$(echo 'main')" >> $GITHUB_OUTPUT
else
echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
if [[ "${{ github.head_ref || github.ref_name }}" == "next" ]]; then
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.beta-plugins }}')" >> $GITHUB_OUTPUT
echo "branch=$(echo 'next')" >> $GITHUB_OUTPUT
elif [[ "${{ github.head_ref || github.ref_name }}" == "develop" ]]; then
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.alpha-plugins }}')" >> $GITHUB_OUTPUT
echo "branch=$(echo 'develop')" >> $GITHUB_OUTPUT
else
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.rc-plugins }}')" >> $GITHUB_OUTPUT
echo "branch=$(echo 'main')" >> $GITHUB_OUTPUT
fi
- uses: actions/create-github-app-token@v1
id: app-token

View File

@ -19,20 +19,34 @@ on:
description: 'Please enter the pr number of nocobase/nocobase repository'
required: false
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
build-and-push:
runs-on: ubuntu-latest
needs: get-plugins
services:
verdaccio:
image: verdaccio/verdaccio:latest
ports:
- 4873:4873
steps:
- name: Get pro plugins
id: get-info
run: |
if [[ "${{ github.head_ref || github.ref_name }}" == "next" ]]; then
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.beta-plugins }}')" >> $GITHUB_OUTPUT
elif [[ "${{ github.head_ref || github.ref_name }}" == "develop" ]]; then
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.alpha-plugins }}')" >> $GITHUB_OUTPUT
else
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.rc-plugins }}')" >> $GITHUB_OUTPUT
fi
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,plugin-${{ inputs.pro_plugin }},${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
repositories: nocobase,pro-plugins,plugin-${{ inputs.pro_plugin }},${{ join(fromJSON(steps.get-info.outputs.proRepos), ',') }}
skip-token-revoke: true
- name: Checkout nocobase/nocobase
uses: actions/checkout@v4

View File

@ -0,0 +1,95 @@
name: Manual release develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
is_feat:
description: 'is feat'
type: boolean
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
update-version:
needs: get-plugins
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(needs.get-plugins.outputs.alpha-plugins), ',') }},${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ',') }}
skip-token-revoke: true
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Checkout
uses: actions/checkout@v4
with:
repository: nocobase/nocobase
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
fetch-depth: 0
ref: develop
- name: Checkout pro-plugins
uses: actions/checkout@v4
with:
repository: nocobase/pro-plugins
path: packages/pro-plugins
fetch-depth: 0
ref: develop
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
- name: Clone pro repos
shell: bash
run: |
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.alpha-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
git clone -b develop https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
done
- name: Set Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Lerna
run: npm install -g lerna@4 auto-changelog@2
- name: Run release.sh
shell: bash
run: |
cd ./packages/pro-plugins
git checkout develop
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.alpha-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
echo "@nocobase/$repo" >> .git/info/exclude
done
echo "$(<.git/info/exclude )"
cd ./../..
git checkout develop
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
echo "packages/pro-plugins" >> .git/info/exclude
bash release.sh $IS_FEAT
env:
IS_FEAT: ${{ inputs.is_feat && '--is-feat' || '' }}
PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.alpha-plugins }}
CUSTOM_PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.custom-plugins }}
- name: Push
run: |
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.alpha-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
cd ./packages/pro-plugins/@nocobase/$repo
git push origin develop --atomic --tags
cd ../../../../
done
cd ./packages/pro-plugins
git push origin develop --atomic --tags
cd ../../
git push origin develop --tags --atomic

View File

@ -6,9 +6,58 @@ concurrency:
on:
workflow_dispatch:
inputs:
is_feat:
description: 'is feat'
type: boolean
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
pre-merge-next-into-develop:
needs: get-plugins
runs-on: ubuntu-latest
strategy:
matrix:
repo:
- 'nocobase'
- 'pro-plugins'
- ${{ fromJSON(needs.get-plugins.outputs.beta-plugins) }}
- ${{ fromJSON(needs.get-plugins.outputs.custom-plugins) }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ',') }},${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ',') }}
skip-token-revoke: true
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Checkout
uses: actions/checkout@v4
with:
# ref: 'main'
repository: nocobase/${{ matrix.repo }}
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: next -> develop (nocobase/${{ matrix.repo }})
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
git checkout next
git pull origin next
git checkout develop
git merge next
git push origin develop --tags --atomic
update-version:
needs:
- get-plugins
- pre-merge-next-into-develop
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
@ -16,7 +65,7 @@ jobs:
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ',') }},${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ',') }}
skip-token-revoke: true
- name: Get GitHub App User ID
id: get-user-id
@ -30,20 +79,18 @@ jobs:
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
fetch-depth: 0
ref: next
- name: Checkout pro-plugins
uses: actions/checkout@v4
with:
repository: nocobase/pro-plugins
path: packages/pro-plugins
fetch-depth: 0
ref: next
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
- name: Clone pro repos
shell: bash
run: |
for repo in ${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
git clone -b next https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
done
@ -58,7 +105,7 @@ jobs:
run: |
cd ./packages/pro-plugins
git checkout next
for repo in ${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
echo "@nocobase/$repo" >> .git/info/exclude
done
@ -68,19 +115,29 @@ jobs:
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
echo "packages/pro-plugins" >> .git/info/exclude
bash release.sh
bash release.sh $IS_FEAT
env:
PRO_PLUGIN_REPOS: ${{ vars.NEXT_PRO_PLUGIN_REPOS }}
CUSTOM_PRO_PLUGIN_REPOS: ${{ vars.CUSTOM_PRO_PLUGIN_REPOS }}
- name: Push
PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.beta-plugins }}
CUSTOM_PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.custom-plugins }}
IS_FEAT: ${{ inputs.is_feat && '--is-feat' || '' }}
- name: Push and merge into next
run: |
for repo in ${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
cd ./packages/pro-plugins/@nocobase/$repo
git push origin next --atomic --tags
git checkout develop
git merge -X ours next --no-edit
git push origin develop --tags --atomic
cd ../../../../
done
cd ./packages/pro-plugins
git push origin next --atomic --tags
git checkout develop
git merge -X ours next --no-edit
git push origin develop --tags --atomic
cd ../../
git push origin next --tags --atomic
git push origin next --atomic --tags
git checkout develop
git merge -X ours next --no-edit
git push origin develop --tags --atomic

View File

@ -8,22 +8,26 @@ on:
workflow_dispatch:
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
pre-merge-main-into-next:
needs: get-plugins
runs-on: ubuntu-latest
strategy:
matrix:
repo:
- 'nocobase'
- 'pro-plugins'
- ${{ fromJSON(vars.PRO_PLUGIN_REPOS) }}
- ${{ fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS) }}
- ${{ fromJSON(needs.get-plugins.outputs.rc-plugins) }}
- ${{ fromJSON(needs.get-plugins.outputs.custom-plugins) }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(needs.get-plugins.outputs.rc-plugins), ',') }},${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ',') }}
skip-token-revoke: true
- name: Get GitHub App User ID
id: get-user-id
@ -48,6 +52,7 @@ jobs:
git push origin next --tags --atomic
update-version:
needs:
- get-plugins
- pre-merge-main-into-next
runs-on: ubuntu-latest
steps:
@ -56,7 +61,7 @@ jobs:
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(needs.get-plugins.outputs.rc-plugins), ',') }},${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ',') }}
skip-token-revoke: true
- name: Get GitHub App User ID
id: get-user-id
@ -81,7 +86,7 @@ jobs:
- name: Clone pro repos
shell: bash
run: |
for repo in ${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.rc-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
git clone -b main https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
done
@ -96,7 +101,7 @@ jobs:
run: |
cd ./packages/pro-plugins
git checkout main
for repo in ${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.rc-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
echo "@nocobase/$repo" >> .git/info/exclude
done
@ -108,11 +113,11 @@ jobs:
echo "packages/pro-plugins" >> .git/info/exclude
bash release.sh
env:
PRO_PLUGIN_REPOS: ${{ vars.PRO_PLUGIN_REPOS }}
CUSTOM_PRO_PLUGIN_REPOS: ${{ vars.CUSTOM_PRO_PLUGIN_REPOS }}
PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.rc-plugins }}
CUSTOM_PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.custom-plugins }}
- name: Push and merge into next
run: |
for repo in ${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.rc-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
cd ./packages/pro-plugins/@nocobase/$repo
git push origin main --atomic --tags

View File

@ -11,7 +11,11 @@ on:
- 'v*'
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
publish-npm:
needs: get-plugins
runs-on: ubuntu-latest
container: node:18
steps:
@ -20,18 +24,22 @@ jobs:
shell: bash
run: |
if [[ "${{ github.ref_name }}" =~ "beta" ]]; then
echo "defaultTag=$(echo 'latest')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ vars.PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
echo "defaultTag=$(echo 'beta')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.beta-plugins }}')" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ "alpha" ]]; then
echo "defaultTag=$(echo 'alpha')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.alpha-plugins }}')" >> $GITHUB_OUTPUT
else
echo "defaultTag=$(echo 'next')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT
# rc
echo "defaultTag=$(echo 'latest')" >> $GITHUB_OUTPUT
echo "proRepos=$(echo '${{ needs.get-plugins.outputs.rc-plugins }}')" >> $GITHUB_OUTPUT
fi
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(steps.get-info.outputs.proRepos), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
repositories: nocobase,pro-plugins,${{ join(fromJSON(steps.get-info.outputs.proRepos), ',') }},${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ',') }}
skip-token-revoke: true
- name: Checkout
uses: actions/checkout@v3
@ -86,7 +94,7 @@ jobs:
- name: Clone pro repos
shell: bash
run: |
for repo in ${{ join(fromJSON(steps.get-info.outputs.proRepos), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
for repo in ${{ join(fromJSON(steps.get-info.outputs.proRepos), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}
do
git clone -b ${{ github.ref_name }} https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
done
@ -108,16 +116,21 @@ jobs:
yarn release:force --no-verify-access --no-git-reset --registry https://pkg-src.nocobase.com --dist-tag=${{ steps.get-info.outputs.defaultTag }}
push-docker:
runs-on: ubuntu-latest
needs: publish-npm
needs:
- get-plugins
- publish-npm
steps:
- name: Get info
id: get-info
shell: bash
run: |
if [[ "${{ github.ref_name }}" =~ "beta" ]]; then
echo "branch=$(echo 'main')" >> $GITHUB_OUTPUT
echo "defaultTag=$(echo 'beta')" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ "alpha" ]]; then
echo "defaultTag=$(echo 'alpha')" >> $GITHUB_OUTPUT
else
echo "branch=$(echo 'next')" >> $GITHUB_OUTPUT
# rc
echo "defaultTag=$(echo 'latest')" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@v3
@ -147,27 +160,12 @@ jobs:
registry: ${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}
username: ${{ secrets.ALI_DOCKER_USERNAME }}
password: ${{ secrets.ALI_DOCKER_PASSWORD }}
- name: Build and push main
if: ${{ steps.get-info.outputs.branch == 'main' }}
uses: Wandalen/wretry.action@master
- name: Build and push
uses: docker/build-push-action@v3
with:
attempt_limit: 3
action: docker/build-push-action@v3
with: |
context: ./docker/nocobase
file: ./docker/nocobase/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: nocobase/nocobase:main,nocobase/nocobase:latest,${{ steps.meta.outputs.tags }},${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/nocobase/nocobase:main,${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/nocobase/nocobase:latest,${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/${{ steps.meta.outputs.tags }}
- name: Build and push next
if: ${{ steps.get-info.outputs.branch == 'next' }}
uses: Wandalen/wretry.action@master
with:
attempt_limit: 3
action: docker/build-push-action@v3
with: |
context: ./docker/nocobase
file: ./docker/nocobase/Dockerfile.next
platforms: linux/amd64,linux/arm64
push: true
tags: nocobase/nocobase:next,${{ steps.meta.outputs.tags }},${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/nocobase/nocobase:next,${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/${{ steps.meta.outputs.tags }}
context: ./docker/nocobase
build-args: |
CNA_VERSION: ${{ steps.get-info.outputs.defaultTag }}
platforms: linux/amd64,linux/arm64
push: true
tags: nocobase/nocobase:${{ steps.get-info.outputs.defaultTag }},${{ steps.meta.outputs.tags }},${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/nocobase/nocobase:${{ steps.get-info.outputs.defaultTag }},${{ secrets.ALI_DOCKER_PUBLIC_REGISTRY }}/${{ steps.meta.outputs.tags }}

View File

@ -1,10 +1,12 @@
FROM node:18-bullseye-slim as builder
ARG CNA_VERSION
WORKDIR /app
RUN cd /app \
&& yarn config set network-timeout 600000 -g \
&& yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production \
&& npx -y create-nocobase-app@${CNA_VERSION} my-nocobase-app -a -e APP_ENV=production \
&& cd /app/my-nocobase-app \
&& yarn install --production

View File

@ -1,43 +0,0 @@
FROM node:18-bullseye-slim as builder
WORKDIR /app
RUN cd /app \
&& yarn config set network-timeout 600000 -g \
&& npx -y create-nocobase-app@next my-nocobase-app -a -e APP_ENV=production \
&& cd /app/my-nocobase-app \
&& yarn install --production
RUN cd /app \
&& rm -rf nocobase.tar.gz \
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .
FROM node:18-bullseye-slim
# COPY ./sources.list /etc/apt/sources.list
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& set -ex \
# libatomic1 for arm
&& apt-get update && apt-get install -y nginx libaio1
RUN rm -rf /etc/nginx/sites-enabled/default
COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz
WORKDIR /app/nocobase
COPY docker-entrypoint.sh /app/
# COPY docker-entrypoint.sh /usr/local/bin/
# ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 80/tcp
CMD ["/app/docker-entrypoint.sh"]

View File

@ -1,31 +1,40 @@
branch=$(git branch --show-current)
current_version=$(jq -r '.version' lerna.json)
IFS='.-' read -r major minor patch label pre <<< "$current_version"
if [[ "$label" == 'beta' || "$2" == '--is-beta' ]]; then
if [ "$branch" == "main" ]; then
# rc
if [ "$1" == '--is-feat' ]; then
new_version="$major.$minor.0-beta"
new_version="$major.$minor.0"
echo $new_version;
else
new_patch=$((patch + 1))
new_version="$major.$minor.$new_patch-$label"
new_version="$major.$minor.$new_patch"
echo $new_version;
fi
else
elif [ "$branch" == "next" ]; then
# beta
if [ "$1" == '--is-feat' ]; then
new_version="$major.$minor.0-beta.0"
echo $new_version;
else
new_pre=$((pre + 1))
new_version="$major.$minor.$patch-beta.$new_pre"
echo $new_version;
fi
elif [ "$branch" == "develop" ]; then
# alpha
if [ "$1" == '--is-feat' ]; then
new_minor=$((minor + 1))
new_version="$major.$new_minor.0-alpha.0"
echo $new_version;
else
if [ -z "$pre" ]; then
new_version="$major.$minor.$patch-alpha.0"
echo $new_version;
else
new_pre=$((pre + 1))
new_version="$major.$minor.$patch-alpha.$new_pre"
echo $new_version;
fi
new_pre=$((pre + 1))
new_version="$major.$minor.$patch-alpha.$new_pre"
echo $new_version;
fi
else
exit 1
fi
lerna version $new_version --preid alpha --force-publish=* --no-git-tag-version -y

View File

@ -8,7 +8,7 @@ const axios = require('axios');
program
.option('-f, --from [from]')
.option('-t, --to [to]')
.option('-v, --ver [ver]', '', 'beta')
.option('-v, --ver [ver]', '', 'rc')
.option('--test')
.option('--cmsURL [url]')
.option('--cmsToken [token]');
@ -102,7 +102,7 @@ async function parsePackage(files, pkgType, pkg) {
}
async function parsePR(number, pkgType, cwd, pkg, retries = 10) {
let { ver = 'beta' } = program.opts();
let { ver = 'rc' } = program.opts();
// gh pr view 5112 --json author,body,files
let res;
try {
@ -120,7 +120,10 @@ async function parsePR(number, pkgType, cwd, pkg, retries = 10) {
return { number };
}
const { author, body, files, baseRefName, url } = JSON.parse(res);
if (ver === 'alpha' && baseRefName !== 'next') {
if (ver === 'beta' && baseRefName !== 'next') {
return { number };
}
if (ver === 'alpha' && baseRefName !== 'develop') {
return { number };
}
const typeRegExp = /\[x\] ([^(\\\r)]+)/;
@ -342,9 +345,9 @@ async function createRelease(cn, en, to) {
console.log(`Release ${to} already exists`);
return;
}
let { ver = 'beta' } = program.opts();
let { ver = 'rc' } = program.opts();
// gh release create -t title -n note
if (ver === 'alpha') {
if (ver === 'alpha' || ver === 'beta') {
await execa('gh', ['release', 'create', to, '-t', to, '-n', en, '-p']);
return;
}
@ -368,13 +371,30 @@ async function getExistsChangelog(from, to) {
}
async function getVersion() {
let { from, to, ver = 'beta' } = program.opts();
let { from, to, ver = 'rc' } = program.opts();
if (!from || !to) {
// git tag -l --sort=version:refname | grep "v*-ver" | tail -2
const tagPattern = `v*-${ver}`;
const { stdout: tags } = await execa(`git tag -l --sort=creatordate | grep "${tagPattern}" | tail -2`, {
let tagPattern = '';
switch (ver) {
case 'rc':
tagPattern = '^v[1-9]+.[0-9]+.[0-9]+$';
case 'beta':
tagPattern = '^v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+$';
case 'alpha':
tagPattern = '^v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+$';
}
const { stdout: tags } = await execa(`git tag -l --sort=creatordate | grep -E "${tagPattern}" | tail -2`, {
shell: true,
});
// 过渡处理
if (tags.length === 1) {
if (ver === 'rc') {
tags.unshift('v1.3.50-beta');
}
if (ver === 'beta') {
tags.unshift('v1.4.0-alpha.17');
}
}
[from, to] = tags.split('\n');
}
console.log(`From: ${from}, To: ${to}`);
@ -412,7 +432,7 @@ async function postCMS(tag, content, contentCN) {
}
async function writeChangelogAndCreateRelease() {
let { ver = 'beta', test } = program.opts();
let { ver = 'rc', test } = program.opts();
const { from, to } = await getVersion();
let { cn, en } = await getExistsChangelog(from, to);
let exists = false;
@ -434,7 +454,7 @@ async function writeChangelogAndCreateRelease() {
if (test) {
return;
}
if (ver === 'beta' && !exists) {
if (ver === 'rc' && !exists) {
await writeChangelog(cn, en, from, to);
}
await createRelease(cn, en, to);