mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-06 05:59:25 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
8504cb0bfe
10
.github/workflows/changelog-and-release.yml
vendored
10
.github/workflows/changelog-and-release.yml
vendored
@ -6,6 +6,14 @@ concurrency:
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
type: choice
|
||||||
|
description: Please choose a version
|
||||||
|
options:
|
||||||
|
- beta
|
||||||
|
- alpha
|
||||||
|
default: beta
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*-beta'
|
- 'v*-beta'
|
||||||
@ -62,7 +70,7 @@ jobs:
|
|||||||
- name: Run script
|
- name: Run script
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
node scripts/release/changelogAndRelease.js
|
node scripts/release/changelogAndRelease.js --ver ${{ inputs.version }}
|
||||||
env:
|
env:
|
||||||
PRO_PLUGIN_REPOS: ${{ vars.PRO_PLUGIN_REPOS }}
|
PRO_PLUGIN_REPOS: ${{ vars.PRO_PLUGIN_REPOS }}
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
109
.github/workflows/manual-build-pro-plugin-image.yml
vendored
Normal file
109
.github/workflows/manual-build-pro-plugin-image.yml
vendored
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
name: Build Pro Plugin Docker Image
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
pro_plugin:
|
||||||
|
description: 'Please enter a pro plugin name'
|
||||||
|
required: true
|
||||||
|
pr_number:
|
||||||
|
description: 'Please enter the pr number of pro plugin repository'
|
||||||
|
required: false
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
verdaccio:
|
||||||
|
image: verdaccio/verdaccio:latest
|
||||||
|
ports:
|
||||||
|
- 4873:4873
|
||||||
|
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.NEXT_PRO_PLUGIN_REPOS), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
|
||||||
|
skip-token-revoke: true
|
||||||
|
- name: Checkout nocobase/nocobase
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref || github.ref_name }}
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Checkout plugin
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: nocobase/plugin-${{ inputs.pro_plugin }}
|
||||||
|
path: packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }}
|
||||||
|
- name: Checkout pr
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd ./packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }}
|
||||||
|
gh pr checkout ${{ inputs.pr_number }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
- name: rm .git
|
||||||
|
run: rm -rf packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }}/.git && git config --global user.email "you@example.com" && git config --global user.name "Your Name" && git add -A && git commit -m "tmp commit"
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
driver-opts: network=host
|
||||||
|
- name: Login to Aliyun Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ secrets.ALI_DOCKER_REGISTRY }}
|
||||||
|
username: ${{ secrets.ALI_DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.ALI_DOCKER_PASSWORD }}
|
||||||
|
- name: Set tags
|
||||||
|
id: set-tags
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=tags::${{ secrets.ALI_DOCKER_REGISTRY }}/pr-${{ inputs.pr_number }}-${{ inputs.pro_plugin }}"
|
||||||
|
- name: IMAGE_TAG
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: pr-${{ inputs.pr_number }}
|
||||||
|
run: |
|
||||||
|
echo $IMAGE_TAG
|
||||||
|
- name: Set variables
|
||||||
|
run: |
|
||||||
|
target_directory="./packages/pro-plugins/@nocobase"
|
||||||
|
subdirectories=$(find "$target_directory" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | tr '\n' ' ')
|
||||||
|
trimmed_variable=$(echo "$subdirectories" | xargs)
|
||||||
|
packageNames="@nocobase/${trimmed_variable// / @nocobase/}"
|
||||||
|
pluginNames="${trimmed_variable//plugin-/}"
|
||||||
|
BEFORE_PACK_NOCOBASE="yarn add $packageNames -W"
|
||||||
|
APPEND_PRESET_LOCAL_PLUGINS="${pluginNames// /,}"
|
||||||
|
echo "var1=$BEFORE_PACK_NOCOBASE" >> $GITHUB_OUTPUT
|
||||||
|
echo "var2=$APPEND_PRESET_LOCAL_PLUGINS" >> $GITHUB_OUTPUT
|
||||||
|
id: vars
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
build-args: |
|
||||||
|
VERDACCIO_URL=http://localhost:4873/
|
||||||
|
COMMIT_HASH=${GITHUB_SHA}
|
||||||
|
PLUGINS_DIRS=pro-plugins
|
||||||
|
BEFORE_PACK_NOCOBASE=${{ steps.vars.outputs.var1 }}
|
||||||
|
APPEND_PRESET_LOCAL_PLUGINS=${{ steps.vars.outputs.var2 }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.set-tags.outputs.tags }}
|
||||||
|
- name: Deploy NocoBase
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: pr-${{ inputs.pr_number }}
|
||||||
|
run: |
|
||||||
|
echo $IMAGE_TAG
|
||||||
|
export APP_NAME=$(echo $IMAGE_TAG | cut -d ":" -f 2)-${{ inputs.pro_plugin }}
|
||||||
|
echo $APP_NAME
|
||||||
|
curl --retry 2 --location --request POST "${{secrets.NOCOBASE_DEPLOY_HOST}}$APP_NAME" \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
-d "{
|
||||||
|
\"tag\": \"$APP_NAME\",
|
||||||
|
\"dialect\": \"postgres\"
|
||||||
|
}"
|
42
.github/workflows/release-next.yml
vendored
42
.github/workflows/release-next.yml
vendored
@ -28,6 +28,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: next
|
ref: next
|
||||||
|
fetch-depth: 0
|
||||||
- name: Send curl request and parse response
|
- name: Send curl request and parse response
|
||||||
env:
|
env:
|
||||||
PKG_USERNAME: ${{ secrets.PKG_USERNAME }}
|
PKG_USERNAME: ${{ secrets.PKG_USERNAME }}
|
||||||
@ -87,8 +88,6 @@ jobs:
|
|||||||
yarn config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
yarn config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
||||||
yarn install
|
yarn install
|
||||||
yarn lerna version ${{ env.NEWVERSION }} -y --no-git-tag-version
|
yarn lerna version ${{ env.NEWVERSION }} -y --no-git-tag-version
|
||||||
git tag v${{ env.NEWVERSION }}
|
|
||||||
git push origin v${{ env.NEWVERSION }}
|
|
||||||
yarn build
|
yarn build
|
||||||
echo "# test" >> Release.md
|
echo "# test" >> Release.md
|
||||||
git add .
|
git add .
|
||||||
@ -101,6 +100,7 @@ jobs:
|
|||||||
repository: nocobase/pro-plugins
|
repository: nocobase/pro-plugins
|
||||||
path: packages/pro-plugins
|
path: packages/pro-plugins
|
||||||
ref: next
|
ref: next
|
||||||
|
fetch-depth: 0
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
- name: Clone pro repos
|
- name: Clone pro repos
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -109,19 +109,6 @@ jobs:
|
|||||||
do
|
do
|
||||||
git clone -b next https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
|
git clone -b next https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
|
||||||
done
|
done
|
||||||
- name: Tag Pro plugins
|
|
||||||
run: |
|
|
||||||
cd ./packages/pro-plugins
|
|
||||||
git tag v${{ env.NEWVERSION }}
|
|
||||||
git push origin v${{ env.NEWVERSION }}
|
|
||||||
cd ../../
|
|
||||||
for repo in ${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
|
|
||||||
do
|
|
||||||
cd ./packages/pro-plugins/@nocobase/$repo
|
|
||||||
git tag v${{ env.NEWVERSION }}
|
|
||||||
git push origin v${{ env.NEWVERSION }}
|
|
||||||
cd ../../../../
|
|
||||||
done
|
|
||||||
- name: Build Pro plugins
|
- name: Build Pro plugins
|
||||||
run: |
|
run: |
|
||||||
yarn config set registry https://registry.npmjs.org/
|
yarn config set registry https://registry.npmjs.org/
|
||||||
@ -132,17 +119,36 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git reset --hard
|
git reset --hard
|
||||||
npm config set //pkg.nocobase.com/:_authToken=${{ env.PKG_NOCOBASE_TOKEN }}
|
npm config set //pkg.nocobase.com/:_authToken=${{ env.PKG_NOCOBASE_TOKEN }}
|
||||||
yarn release:force --no-verify-access --no-git-reset --registry https://pkg.nocobase.com --dist-tag=next
|
# yarn release:force --no-verify-access --no-git-reset --registry https://pkg.nocobase.com --dist-tag=next
|
||||||
- name: publish pkg-src.nocobase.com
|
- name: publish pkg-src.nocobase.com
|
||||||
run: |
|
run: |
|
||||||
git reset --hard
|
git reset --hard
|
||||||
bash generate-npmignore.sh ignore-src
|
bash generate-npmignore.sh ignore-src
|
||||||
npm config set //pkg-src.nocobase.com/:_authToken=${{ env.PKG_SRC_NOCOBASE_TOKEN }}
|
npm config set //pkg-src.nocobase.com/:_authToken=${{ env.PKG_SRC_NOCOBASE_TOKEN }}
|
||||||
yarn release:force --no-verify-access --no-git-reset --registry https://pkg-src.nocobase.com --dist-tag=next
|
yarn release:force --no-verify-access --no-git-reset --registry https://pkg-src.nocobase.com --dist-tag=next
|
||||||
- name: Run script
|
- name: Tag
|
||||||
|
run: |
|
||||||
|
git reset --hard HEAD~
|
||||||
|
git tag v${{ env.NEWVERSION }}
|
||||||
|
git push origin v${{ env.NEWVERSION }}
|
||||||
|
cd ./packages/pro-plugins
|
||||||
|
git reset --hard
|
||||||
|
git tag v${{ env.NEWVERSION }}
|
||||||
|
git push origin v${{ env.NEWVERSION }}
|
||||||
|
cd ../../
|
||||||
|
for repo in ${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ' ') }} ${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ' ') }}
|
||||||
|
do
|
||||||
|
cd ./packages/pro-plugins/@nocobase/$repo
|
||||||
|
git reset --hard
|
||||||
|
git tag v${{ env.NEWVERSION }}
|
||||||
|
git push origin v${{ env.NEWVERSION }}
|
||||||
|
cd ../../../../
|
||||||
|
done
|
||||||
|
- name: Run release script
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
node scripts/release/changelogAndRelease.js --ver alpha
|
git fetch
|
||||||
|
node scripts/release/changelogAndRelease.js --ver alpha --test
|
||||||
env:
|
env:
|
||||||
PRO_PLUGIN_REPOS: ${{ vars.NEXT_PRO_PLUGIN_REPOS }}
|
PRO_PLUGIN_REPOS: ${{ vars.NEXT_PRO_PLUGIN_REPOS }}
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
@ -4,7 +4,7 @@ const path = require('path');
|
|||||||
const { Command } = require('commander');
|
const { Command } = require('commander');
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
program.option('-f, --from [from]').option('-t, --to [to]').option('-v, --ver [ver]');
|
program.option('-f, --from [from]').option('-t, --to [to]').option('-v, --ver [ver]').option('--test');
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
|
|
||||||
const header = {
|
const header = {
|
||||||
@ -345,11 +345,16 @@ async function createRelease(cn, en, to) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function writeChangelogAndCreateRelease() {
|
async function writeChangelogAndCreateRelease() {
|
||||||
let { ver = 'beta' } = program.opts();
|
let { ver = 'beta', test } = program.opts();
|
||||||
const { cn, en, from, to } = await generateChangelog();
|
const { cn, en, from, to } = await generateChangelog();
|
||||||
if (!cn && !en) {
|
if (!cn && !en) {
|
||||||
throw new Error('No changelog generated');
|
throw new Error('No changelog generated');
|
||||||
}
|
}
|
||||||
|
if (test) {
|
||||||
|
console.log(en);
|
||||||
|
console.log(cn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ver === 'beta') {
|
if (ver === 'beta') {
|
||||||
await writeChangelog(cn, en, from, to);
|
await writeChangelog(cn, en, from, to);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user