name: Split Repositories on: push: branches: - v6-dev - v8-dev workflow_dispatch: permissions: contents: read concurrency: group: split-${{ github.ref_name }} cancel-in-progress: false jobs: split: if: github.repository == 'zoujingli/ThinkAdmin' runs-on: ubuntu-latest env: SSH_PRIVATE_KEY: ${{ secrets.SPLIT_PRIVATE_KEY }} steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Guard Branch run: | case "${GITHUB_REF_NAME}" in v6-dev|v8-dev) ;; *) echo "Unsupported split branch: ${GITHUB_REF_NAME}" >&2; exit 1 ;; esac - name: Check Split Secret id: split_secret run: | if [ -z "$SSH_PRIVATE_KEY" ]; then echo "::warning title=Skip Split::Repository secret SPLIT_PRIVATE_KEY is not configured, skip plugin repository split." echo "enabled=false" >> "$GITHUB_OUTPUT" else echo "enabled=true" >> "$GITHUB_OUTPUT" fi - name: Setup Private Key if: steps.split_secret.outputs.enabled == 'true' run: | mkdir -p ~/.ssh echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan github.com >> ~/.ssh/known_hosts echo "StrictHostKeyChecking no" >> ~/.ssh/config - name: Split And Push if: steps.split_secret.outputs.enabled == 'true' run: | git config pull.rebase true git config --global user.name "Anyon" git config --global user.email "zoujingli@qq.com" ./.github/split-linux.sh