chore(ci): update

This commit is contained in:
xilesun 2024-10-10 18:16:04 +08:00
parent 2c09164b19
commit 25a52578c3

View File

@ -12,7 +12,7 @@ on:
required: true required: true
pr_number: pr_number:
description: 'Please enter the pr number of pro plugin repository' description: 'Please enter the pr number of pro plugin repository'
required: true required: false
nocobase_pr_number: nocobase_pr_number:
description: 'Please enter the pr number of nocobase/nocobase repository' description: 'Please enter the pr number of nocobase/nocobase repository'
required: false required: false
@ -38,7 +38,7 @@ jobs:
ref: ${{ github.head_ref || github.ref_name }} ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0 fetch-depth: 0
- name: Checkout nocobase/nocobase pr - name: Checkout nocobase/nocobase pr
continue-on-error: true if: ${{ inputs.nocobase_pr_number != '' }}
shell: bash shell: bash
run: | run: |
gh pr checkout ${{ inputs.nocobase_pr_number }} gh pr checkout ${{ inputs.nocobase_pr_number }}
@ -47,11 +47,12 @@ jobs:
- name: Checkout plugin - name: Checkout plugin
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: main ref: ${{ github.head_ref || github.ref_name }}
token: ${{ steps.app-token.outputs.token }} token: ${{ steps.app-token.outputs.token }}
repository: nocobase/plugin-${{ inputs.pro_plugin }} repository: nocobase/plugin-${{ inputs.pro_plugin }}
path: packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }} path: packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }}
- name: Checkout pr - name: Checkout pr
if: ${{ inputs.pr_number != '' }}
shell: bash shell: bash
run: | run: |
cd ./packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }} cd ./packages/pro-plugins/@nocobase/plugin-${{ inputs.pro_plugin }}
@ -73,13 +74,21 @@ jobs:
registry: ${{ secrets.ALI_DOCKER_REGISTRY }} registry: ${{ secrets.ALI_DOCKER_REGISTRY }}
username: ${{ secrets.ALI_DOCKER_USERNAME }} username: ${{ secrets.ALI_DOCKER_USERNAME }}
password: ${{ secrets.ALI_DOCKER_PASSWORD }} password: ${{ secrets.ALI_DOCKER_PASSWORD }}
- name: Get tag
id: get-tag
run: |
if [${{ inputs.pr_number }} != '']; then
echo "tag=pr-${{ inputs.pr_number }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Set tags - name: Set tags
id: set-tags id: set-tags
run: | run: |
echo "::set-output name=tags::${{ secrets.ALI_DOCKER_REGISTRY }}/nocobase/nocobase:pr-${{ inputs.pr_number }}-${{ inputs.pro_plugin }}" echo "::set-output name=tags::${{ secrets.ALI_DOCKER_REGISTRY }}/nocobase/nocobase:${{ steps.get-tag.outputs.tag }}-${{ inputs.pro_plugin }}"
- name: IMAGE_TAG - name: IMAGE_TAG
env: env:
IMAGE_TAG: pr-${{ inputs.pr_number }} IMAGE_TAG: ${{ steps.get-tag.outputs.tag }}
run: | run: |
echo $IMAGE_TAG echo $IMAGE_TAG
- name: Set variables - name: Set variables
@ -109,7 +118,7 @@ jobs:
tags: ${{ steps.set-tags.outputs.tags }} tags: ${{ steps.set-tags.outputs.tags }}
- name: Deploy NocoBase - name: Deploy NocoBase
env: env:
IMAGE_TAG: pr-${{ inputs.pr_number }} IMAGE_TAG: ${{ steps.get-tag.outputs.tag }}
run: | run: |
echo $IMAGE_TAG echo $IMAGE_TAG
export APP_NAME=$(echo $IMAGE_TAG | cut -d ":" -f 2)-${{ inputs.pro_plugin }} export APP_NAME=$(echo $IMAGE_TAG | cut -d ":" -f 2)-${{ inputs.pro_plugin }}