forked from openyurtio/raven
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openyurtio#93 from luckymrwang/sync-charts
chore: sync charts from raven to openyurt-helm
- Loading branch information
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Sync Charts | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'charts/**' | ||
|
||
jobs: | ||
sync-charts: | ||
if: github.repository == 'openyurtio/raven' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- 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 | ||
env: | ||
SSH_DEPLOY_KEY: ${{ secrets.SYNC_CHARTS_SECRET }} | ||
VERSION: ${{ steps.get_version.outputs.VERSION }} | ||
TAG: ${{ steps.get_version.outputs.TAG }} | ||
COMMIT_ID: ${{ github.sha }} | ||
run: | | ||
bash ./hack/lib/sync-charts.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash -l | ||
# Copyright 2020 The OpenYurt Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
if [[ -n "$SSH_DEPLOY_KEY" ]] | ||
then | ||
mkdir -p ~/.ssh | ||
echo "$SSH_DEPLOY_KEY" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
fi | ||
|
||
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 | ||
|
||
echo "clear openyurt-helm charts/raven" | ||
|
||
if [ -d "openyurt-helm/charts/raven" ] | ||
then | ||
echo "charts raven exists, remove it" | ||
rm -r openyurt-helm/charts/raven/* | ||
else | ||
mkdir -p openyurt-helm/charts/raven | ||
fi | ||
|
||
echo "copy folder raven/charts to openyurt-helm/charts" | ||
|
||
cp -R raven/charts/raven-agent/* openyurt-helm/charts/raven-agent/ | ||
|
||
echo "push to openyurt-helm" | ||
echo "version: $VERSION, commit: $COMMIT_ID, tag: $TAG" | ||
|
||
cd openyurt-helm | ||
|
||
if [ -z "$(git status --porcelain)" ]; then | ||
echo "nothing need to push, finished!" | ||
else | ||
git add . | ||
git commit -m "align with raven charts $VERSION from commit $COMMIT_ID" | ||
git tag "$VERSION" | ||
git push origin main | ||
fi |