Skip to content

Commit

Permalink
Merge pull request #174 from rambohe-ch/update-sync-charts
Browse files Browse the repository at this point in the history
feat: adjust sync raven charts to openyurtio/charts
  • Loading branch information
njucjc authored Jul 29, 2024
2 parents 2199e01 + 4ae6d3c commit d6005a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/sync-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 10 additions & 12 deletions hack/lib/sync-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,30 @@ echo "git clone"
cd ..
git config --global user.email "[email protected]"
git config --global user.name "openyurt-bot"
git clone --single-branch --depth 1 [email protected]:openyurtio/openyurt-helm.git openyurt-helm
git clone --single-branch --depth 1 [email protected]: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

0 comments on commit d6005a8

Please sign in to comment.