.github/workflows/sync-helm-chart.yaml #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'charts/gatekeeper/**' | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
jobs: | |
sync-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup SSH | |
uses: MrSquaare/ssh-setup-action@v2 | |
with: | |
host: github.com | |
private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Install Helm | |
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | |
with: | |
version: v3.13.0 | |
- run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "ks-ci-bot" | |
git clone --depth 1 [email protected]:ks-ci-bot/ks-extensions.git -b main | |
pushd ks-extensions | |
git remote add upstream [email protected]:kubesphere-extensions/ks-extensions.git | |
git fetch upstream main | |
git checkout -b sync/gatekeeper/${GITHUB_REF#refs/*/} upstream/main | |
popd | |
rm -rf ks-extensions/gatekeeper | |
OUTPUT=ks-extensions/gatekeeper make package | |
pushd ks-extensions | |
git add . | |
git commit -m "update gatekeeper helm chart" | |
git push origin main:sync/gatekeeper/${GITHUB_REF#refs/*/} --force | |
- env: | |
GH_TOKEN: ${{ secrets.CIBOT_ACCESS_TOKEN }} | |
run: | | |
if [[ $(gh pr ls -H sync/gatekeeper/${GITHUB_REF#refs/*/} -B main) == "" ]]; then | |
gh pr create -H sync/gatekeeper/${GITHUB_REF#refs/*/} -B main --title "Update gatekeeper helm chart from ${GITHUB_REF#refs/*/}" --body "Update gatekeeper helm chart" | |
fi |