diff --git a/.github/workflows/sync-charts.yaml b/.github/workflows/sync-charts.yaml index 963a8dd..f65bc2d 100644 --- a/.github/workflows/sync-charts.yaml +++ b/.github/workflows/sync-charts.yaml @@ -6,25 +6,19 @@ on: - main paths: - 'charts/**' + workflow_dispatch: {} jobs: sync-charts: if: github.repository == 'openyurtio/raven' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Get the version - id: get_version - run: | - echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} - echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} - - name: Sync to openyurt-helm Repo + - name: Sync to openyurtio/charts Repo env: - SSH_DEPLOY_KEY: ${{ secrets.SYNC_CHARTS_SECRET }} - VERSION: ${{ steps.get_version.outputs.VERSION }} - TAG: ${{ steps.get_version.outputs.TAG }} + SSH_DEPLOY_KEY: ${{ secrets.SYNC_OPENYURTIO_CHARTS_KEY }} COMMIT_ID: ${{ github.sha }} run: | bash ./hack/lib/sync-charts.sh \ No newline at end of file diff --git a/hack/lib/sync-charts.sh b/hack/lib/sync-charts.sh index 4c03fee..21e3fc5 100644 --- a/hack/lib/sync-charts.sh +++ b/hack/lib/sync-charts.sh @@ -26,32 +26,30 @@ echo "git clone" cd .. git config --global user.email "openyurt-bot@openyurt.io" git config --global user.name "openyurt-bot" -git clone --single-branch --depth 1 git@github.com:openyurtio/openyurt-helm.git openyurt-helm +git clone --single-branch --depth 1 git@github.com:openyurtio/charts.git charts -echo "clear openyurt-helm charts/raven-agent" +echo "clear charts/raven-agent of openyurtio/charts" -if [ -d "openyurt-helm/charts/raven-agent" ] +if [ -d "charts/charts/raven-agent" ] then echo "charts raven-agent exists, remove it" - rm -r openyurt-helm/charts/raven-agent/* + rm -r charts/charts/raven-agent/* else - mkdir -p openyurt-helm/charts/raven-agent + mkdir -p charts/charts/raven-agent fi -echo "copy folder raven/charts to openyurt-helm/charts" +echo "copy folder raven/charts to openyurtio/charts/charts" -cp -R raven/charts/raven-agent/* openyurt-helm/charts/raven-agent/ +cp -R raven/charts/raven-agent/* charts/charts/raven-agent/ -echo "push to openyurt-helm" -echo "version: $VERSION, commit: $COMMIT_ID, tag: $TAG" +echo "push to openyurtio/charts with commit: $COMMIT_ID" -cd openyurt-helm +cd charts if [ -z "$(git status --porcelain)" ]; then echo "nothing need to push, finished!" else git add . - git commit -m "align with raven-agent charts $VERSION from commit $COMMIT_ID" - git tag "$VERSION" + git commit -m "align with raven-agent charts from commit $COMMIT_ID" git push origin main fi