Files
license-manager/.github/workflows/sync_to_enterprise.yml
T

51 lines
1.3 KiB
YAML

# 同步社区版代码到企业版
name: Sync to Enterprise
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
# 1. 检出当前仓库
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# 2. 配置远程仓库
- name: Configure remote
run: |
git remote add enterprise https://${{ secrets.ENTERPRISE_GH_TOKEN }}@github.com/cedar-v/license-manager-enterprise.git
git remote -v
shell: bash
# 3. 配置 Git 用户信息
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
shell: bash
# 4. 切换到 license-manager 分支,不存在则创建
- name: Switch to license-manager branch
run: |
git checkout license-manager || git checkout -b license-manager
shell: bash
# 5. 合并 main 分支的更新
- name: Merge main to license-manager
run: |
git merge origin/main --no-edit
shell: bash
# 6. 推送到企业版仓库
- name: Push to enterprise
run: |
git push enterprise license-manager --force
shell: bash