chore(ci): optimize

This commit is contained in:
xilesun 2024-10-18 10:30:58 +08:00
parent c8741e7656
commit 495dde46ab
3 changed files with 26 additions and 18 deletions

View File

@ -38,7 +38,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: nocobase/nocobase
ref: main
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
fetch-depth: 0
@ -47,6 +47,7 @@ jobs:
with:
repository: nocobase/pro-plugins
path: packages/pro-plugins
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
@ -55,7 +56,7 @@ jobs:
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
git clone -b ${{ github.head_ref || github.ref_name }} https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo
done
- name: Set user
run: |

View File

@ -1,19 +1,16 @@
name: Manual build pro image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.pr_number }}-${{ github.event.inputs.nocobase_pr_number }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
base_branch:
description: 'Please enter a base branch for main repo'
required: true
default: 'main'
pr_number:
description: 'Please enter a pull request number'
required: true
description: 'Please enter the pr number of pro-plugins'
nocobase_pr_number:
description: 'Please enter the pr number of nocobase/nocobase repository'
jobs:
build-and-push:
@ -43,22 +40,32 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.base_branch }}
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ steps.app-token.outputs.token }}
submodules: true
- name: Set PR branch
id: set_pro_pr_branch
if: inputs.pr_number != 'main'
run: echo "pr_branch=refs/pull/${{ github.event.inputs.pr_number }}/head" >> $GITHUB_OUTPUT
- name: Echo PR branch
run: echo "${{ steps.set_pro_pr_branch.outputs.pr_branch }}"
- name: Checkout nocobase/nocobase pr
if: ${{ inputs.nocobase_pr_number != '' }}
shell: bash
run: |
gh pr checkout ${{ inputs.nocobase_pr_number }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Checkout pro-plugins
uses: actions/checkout@v3
with:
repository: nocobase/pro-plugins
path: packages/pro-plugins
ref: ${{ steps.set_pro_pr_branch.outputs.pr_branch || 'main' }}
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ steps.app-token.outputs.token }}
- name: Checkout pr
if: ${{ inputs.pr_number != '' }}
shell: bash
run: |
cd ./packages/pro-plugins/
gh pr checkout ${{ inputs.pr_number }}
cd ../../
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Clone pro repos
shell: bash
run: |

View File

@ -1,7 +1,7 @@
name: Build pro plugin docker image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.pro_plugin }}-${{ github.events.inputs.pr_number }}-${{ github.events.inputs.nocobase_pr_number }}
cancel-in-progress: true
on: