Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adjust sync raven charts to openyurtio/charts #174

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading