-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into main
- Loading branch information
Showing
296 changed files
with
4,794 additions
and
1,852 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,25 @@ jobs: | |
ports: | ||
- 4873:4873 | ||
steps: | ||
- 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 | ||
else | ||
echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $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-pro-plugins.outputs.proRepos), ',') }} | ||
skip-token-revoke: true | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} | ||
token: ${{ steps.app-token.outputs.token }} | ||
submodules: true | ||
- name: Checkout pro-plugins | ||
uses: actions/checkout@v3 | ||
|
@@ -36,7 +51,7 @@ jobs: | |
ref: main | ||
path: packages/pro-plugins | ||
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 | ||
|
@@ -48,8 +63,37 @@ jobs: | |
git checkout main | ||
fi | ||
fi | ||
- name: Clone pro repos | ||
shell: bash | ||
run: | | ||
for repo in ${{ join(fromJSON(steps.get-pro-plugins.outputs.proRepos), ' ') }} | ||
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 | ||
- run: | | ||
for repo in ${{ join(fromJSON(steps.get-pro-plugins.outputs.proRepos), ' ') }} | ||
do | ||
cd ./packages/pro-plugins/@nocobase/$repo | ||
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 ../../../../ | ||
done | ||
- name: rm .git | ||
run: rm -rf packages/pro-plugins/.git && git config --global user.email "[email protected]" && git config --global user.name "Your Name" && git add -A && git commit -m "tmp commit" | ||
run: | | ||
rm -rf packages/pro-plugins/.git | ||
for repo in ${{ join(fromJSON(steps.get-pro-plugins.outputs.proRepos), ' ') }} | ||
do | ||
rm -rf packages/pro-plugins/@nocobase/$repo/.git | ||
done | ||
git config --global user.email "[email protected]" | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Write changelog and create release | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: choice | ||
description: Please choose a version | ||
options: | ||
- beta | ||
- alpha | ||
default: beta | ||
push: | ||
tags: | ||
- 'v*-beta' | ||
|
||
jobs: | ||
write-changelog-and-release: | ||
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(vars.PRO_PLUGIN_REPOS), ',') }} | ||
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 | ||
ref: main | ||
token: ${{ steps.app-token.outputs.token }} | ||
persist-credentials: true | ||
fetch-depth: 0 | ||
- name: Checkout pro-plugins | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: nocobase/pro-plugins | ||
path: packages/pro-plugins | ||
fetch-depth: 0 | ||
token: ${{ steps.app-token.outputs.token }} | ||
persist-credentials: true | ||
- name: Clone pro repos | ||
shell: bash | ||
run: | | ||
for repo in ${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ' ') }} | ||
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 | ||
- name: Set user | ||
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>' | ||
- name: Set Node.js 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Run script | ||
shell: bash | ||
run: | | ||
node scripts/release/changelogAndRelease.js --ver ${{ inputs.version }} | ||
env: | ||
PRO_PLUGIN_REPOS: ${{ vars.PRO_PLUGIN_REPOS }} | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
- name: Commit and push | ||
run: | | ||
git pull origin main | ||
git add . | ||
git commit -m "docs: update changelogs" | ||
git push origin main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Get nocobase app github token | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
token: | ||
value: ${{ jobs.get-app-token.outputs.token }} | ||
user-id: | ||
value: ${{ jobs.get-app-token.outputs.user-id }} | ||
app-slug: | ||
value: ${{ jobs.get-app-token.outputs.app-slug }} | ||
|
||
jobs: | ||
get-app-token: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
token: ${{ steps.encrypt-token.outputs.token }} | ||
app-slug: ${{ steps.app-token.outputs.app-slug }} | ||
user-id: ${{ steps.get-user-id.outputs.user-id }} | ||
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), ',') }} | ||
skip-token-revoke: true | ||
- name: Encrypt token | ||
id: encrypt-token | ||
shell: bash | ||
run: | | ||
APP_TOKEN=${{ steps.app-token.outputs.token }}; | ||
ENCRYPTED_SECRET=$(echo -n "$APP_TOKEN" | openssl enc -aes-256-cbc -pbkdf2 -salt -k "${{ secrets.APP_TOKEN_ENCRYPTION_PASSWORD }}" | base64 -w 0); | ||
echo "token=$ENCRYPTED_SECRET" >> $GITHUB_OUTPUT | ||
- 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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,26 @@ jobs: | |
ports: | ||
- 4873:4873 | ||
steps: | ||
- 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 | ||
else | ||
echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $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-pro-plugins.outputs.proRepos), ',') }} | ||
skip-token-revoke: true | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.base_branch }} | ||
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} | ||
token: ${{ steps.app-token.outputs.token }} | ||
submodules: true | ||
- name: Set PR branch | ||
id: set_pro_pr_branch | ||
|
@@ -43,9 +58,23 @@ jobs: | |
repository: nocobase/pro-plugins | ||
path: packages/pro-plugins | ||
ref: ${{ steps.set_pro_pr_branch.outputs.pr_branch || 'main' }} | ||
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} | ||
token: ${{ steps.app-token.outputs.token }} | ||
- name: Clone pro repos | ||
shell: bash | ||
run: | | ||
for repo in ${{ join(fromJSON(steps.get-pro-plugins.outputs.proRepos), ' ') }} | ||
do | ||
git clone -b ${{ steps.set_pro_pr_branch.outputs.pr_branch || 'main' }} https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo | ||
done | ||
- name: rm .git | ||
run: rm -rf packages/pro-plugins/.git && git config --global user.email "[email protected]" && git config --global user.name "Your Name" && git add -A && git commit -m "tmp commit" | ||
run: | | ||
rm -rf packages/pro-plugins/.git | ||
for repo in ${{ join(fromJSON(steps.get-pro-plugins.outputs.proRepos), ' ') }} | ||
do | ||
rm -rf packages/pro-plugins/@nocobase/$repo/.git | ||
done | ||
git config --global user.email "[email protected]" | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
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: | ||
ref: main | ||
token: ${{ steps.app-token.outputs.token }} | ||
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 }} | ||
cd ../../../../ | ||
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 "[email protected]" && 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 }}/nocobase/nocobase: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\" | ||
}" |
Oops, something went wrong.