chore(ci): manual-merge.yml (#5783)

* feat(ci): release major version

* fix: bug

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* feat: manual merge

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update
This commit is contained in:
YANG QIA 2024-12-03 20:12:25 +08:00 committed by GitHub
parent fa315a1261
commit 66f2250641
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 97 additions and 1 deletions

89
.github/workflows/manual-merge.yml vendored Normal file
View File

@ -0,0 +1,89 @@
name: Manual merge
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
get-plugins:
uses: nocobase/nocobase/.github/workflows/get-plugins.yml@main
secrets: inherit
get-repos:
runs-on: ubuntu-latest
needs: get-plugins
outputs:
proRepos: ${{ steps.get-repos.outputs.proRepos }}
steps:
- name: Get repos
id: get-repos
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
exit 1
fi
merge:
runs-on: ubuntu-latest
needs:
- get-plugins
- get-repos
strategy:
fail-fast: false
matrix:
repo:
- 'nocobase'
- 'pro-plugins'
- ${{ fromJSON(needs.get-repos.outputs.proRepos) }}
- ${{ fromJSON(needs.get-plugins.outputs.custom-plugins) }}
steps:
- name: Get info
id: get-info
run: |
if [[ "${{ github.head_ref || github.ref_name }}" == "next" ]]; then
echo "baseBranch=$(echo 'next')" >> $GITHUB_OUTPUT
echo "targetBranch=$(echo 'main')" >> $GITHUB_OUTPUT
elif [[ "${{ github.head_ref || github.ref_name }}" == "develop" ]]; then
echo "baseBranch=$(echo 'develop')" >> $GITHUB_OUTPUT
echo "targetBranch=$(echo 'next')" >> $GITHUB_OUTPUT
else
exit 1
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: ${{ matrix.repo }}
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: ${{ steps.get-info.outputs.baseBranch }}
repository: nocobase/${{ matrix.repo }}
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Merge ${{ steps.get-info.outputs.targetBranch }} into ${{ steps.get-info.outputs.baseBranch }}
shell: bash
run: |
git checkout ${{ steps.get-info.outputs.targetBranch }}
git pull origin ${{ steps.get-info.outputs.targetBranch }}
git checkout ${{ steps.get-info.outputs.baseBranch }}
git pull origin ${{ steps.get-info.outputs.baseBranch }}
git merge ${{ steps.get-info.outputs.targetBranch }}
git push origin ${{ steps.get-info.outputs.baseBranch }} --atomic --tags
- name: Merge ${{ steps.get-info.outputs.baseBranch }} into ${{ steps.get-info.outputs.targetBranch }}
shell: bash
run: |
git checkout ${{ steps.get-info.outputs.targetBranch }}
git merge ${{ steps.get-info.outputs.baseBranch }}
git push origin ${{ steps.get-info.outputs.targetBranch }} --atomic --tags

View File

@ -10,6 +10,9 @@ on:
is_feat: is_feat:
description: 'is feat' description: 'is feat'
type: boolean type: boolean
add_minor:
description: 'add minor number'
type: boolean
jobs: jobs:
get-plugins: get-plugins:
@ -115,11 +118,12 @@ jobs:
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' 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 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 echo "packages/pro-plugins" >> .git/info/exclude
bash release.sh $IS_FEAT bash release.sh $IS_FEAT $ADD_MINOR
env: env:
PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.beta-plugins }} PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.beta-plugins }}
CUSTOM_PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.custom-plugins }} CUSTOM_PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.custom-plugins }}
IS_FEAT: ${{ inputs.is_feat && '--is-feat' || '' }} IS_FEAT: ${{ inputs.is_feat && '--is-feat' || '' }}
ADD_MINOR: ${{ inputs.add_minor && '--add-minor' || '' }}
- name: Push and merge into next - name: Push and merge into next
run: | run: |
for repo in ${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }} for repo in ${{ join(fromJSON(needs.get-plugins.outputs.beta-plugins), ' ') }} ${{ join(fromJSON(needs.get-plugins.outputs.custom-plugins), ' ') }}

View File

@ -15,6 +15,9 @@ if [ "$branch" == "main" ]; then
elif [ "$branch" == "next" ]; then elif [ "$branch" == "next" ]; then
# beta # beta
if [ "$1" == '--is-feat' ]; then if [ "$1" == '--is-feat' ]; then
if [ "$2" == '--add-minor' ]; then
minor=$((minor + 1))
fi
new_version="$major.$minor.0-beta.1" new_version="$major.$minor.0-beta.1"
echo $new_version; echo $new_version;
else else