name: SyncHelmChart on: workflow_dispatch: push: paths: - 'config/ks-core/**' branches: - 'master' - 'release-*' tags: - 'helm-chart-*' - 'v*' jobs: sync-chart: runs-on: ubuntu-latest steps: - name: Check out kubesphere/kubesphere uses: actions/checkout@v4 with: path: kubesphere fetch-depth: 0 - name: Check out kubesphere/helm-charts uses: actions/checkout@v4 with: repository: ks-ci-bot/helm-charts token: ${{ secrets.CIBOT_ACCESS_TOKEN }} path: helm-charts fetch-depth: 0 - name: Setup SSH uses: MrSquaare/ssh-setup-action@v3 with: working-directory: helm-charts host: github.com private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Sync charts run: | cd helm-charts git config --global user.email "ci-bot@kubesphere.io" git config --global user.name "ks-ci-bot" git remote add ks git@github.com:kubesphere/helm-charts.git git fetch ks master git checkout -b sync/ks-core/${GITHUB_REF#refs/*/} ks/master rm -rf src/test/ks-core cp -r ../kubesphere/config/ks-core src/test/ if [[ ${GITHUB_REF#refs/*/} =~ ^helm-chart-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then rm -rf src/main/ks-core cp -r ../kubesphere/config/ks-core src/main/ fi git add . git commit -m "update ks-core helm chart" git push origin sync/ks-core/${GITHUB_REF#refs/*/} --force - name: Create Pull Request env: GH_TOKEN: ${{ secrets.CIBOT_ACCESS_TOKEN }} run: | cd helm-charts if [[ $(gh pr ls -R kubesphere/helm-charts -A ks-ci-bot -H sync/ks-core/${GITHUB_REF#refs/*/} -B master) == "" ]]; then # Create a PR in the kubesphere/helm-charts repository gh pr create -R kubesphere/helm-charts \ -B master \ -H ks-ci-bot:sync/ks-core/${GITHUB_REF#refs/*/} \ -t "Update ks-core helm chart from ${GITHUB_REF#refs/*/}" \ -b "Update ks-core helm chart" fi