-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add auto-sync-manifest.yml workflow
- Loading branch information
Showing
1 changed file
with
62 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,62 @@ | ||
name: Auto Sync Manifest | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
RELEASE_VERSION: | ||
description: 'The version of release' | ||
type: string | ||
required: true | ||
default: '' | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
|
||
jobs: | ||
sync-manifest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: get version | ||
id: get-version | ||
run: | | ||
RELEASE_VERSION="${{ inputs.RELEASE_VERSION }}" | ||
if [[ "${RELEASE_VERSION}" != "v"* ]]; then | ||
RELEASE_VERSION="v${RELEASE_VERSION}" | ||
fi | ||
echo "release-version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT | ||
- name: Checkout apecloud Code | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: apecloud/apecloud | ||
path: apecloud | ||
token: ${{ env.GITHUB_TOKEN }} | ||
ref: ${{ steps.get-version.outputs.release-version }} | ||
|
||
- name: check manifest | ||
id: check-manifest | ||
run: | | ||
COMMIT_SHA="$(git rev-parse HEAD)" | ||
release_version="${{ steps.get-version.outputs.release-version }}" | ||
MANIFEST_DIR="manifests/${release_version}" | ||
mkdir -p ${MANIFEST_DIR} | ||
cp -r ${{ github.workspace }}/apecloud/manifests/deploy-manifests.yaml ${MANIFEST_DIR}/manifests.yaml | ||
cp -r ${{ github.workspace }}/apecloud/manifests/deploy-values.yaml ${MANIFEST_DIR}/values.yaml | ||
git add ${MANIFEST_DIR}/* | ||
FILE_CHANGES=`git diff --name-only ${block_index_sha}` | ||
if [[ ! -z "$FILE_CHANGES" ]]; then | ||
echo "FILE_CHANGES:"$FILE_CHANGES | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
git commit -a -m "chore: auto sync manifest ${release_version}" | ||
fi | ||
echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT | ||
echo changes_dir=$MANIFEST_DIR >> $GITHUB_OUTPUT | ||
# - name: Push manifest changes | ||
# uses: ad-m/github-push-action@master | ||
# if: ${{ steps.check-manifest.outputs.file_changes }} | ||
# with: | ||
# directory: ./${{ steps.check-manifest.outputs.changes_dir }} | ||
# github_token: ${{ env.GITHUB_TOKEN }} |