Skip to content

Commit d9007c8

Browse files
add github action to auo sync doc changes to gh-pages (#1059)
Signed-off-by: xudong liu <[email protected]>
1 parent 68a65a5 commit d9007c8

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Sync update to gh-pages branch
2+
3+
on:
4+
push:
5+
# Sequence of patterns matched against refs/tags
6+
tags:
7+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
8+
9+
workflow_dispatch: # Use for manaully trigger to debug
10+
11+
12+
permissions:
13+
contents: write # Allow to create a release.
14+
15+
jobs:
16+
sync-changes-to-gh-pages-branch:
17+
runs-on: ubuntu-latest
18+
steps:
19+
# This step uses Github's checkout-action: https://github.com/actions/checkout
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
# Configure Git for helm release
26+
- name: Configure Git
27+
run: |
28+
git config user.name "$GITHUB_ACTOR"
29+
git config user.email "[email protected]"
30+
31+
- name: Check Latest Release Tag
32+
id: check
33+
run: |
34+
git fetch --tags
35+
36+
latest_tag=$(git tag --sort=-creatordate | head -n 1)
37+
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT
38+
echo "valid=$(./hack/match-release-tag.sh ${latest_tag} >/dev/null 2>&1)" >> $GITHUB_OUTPUT
39+
40+
- name: Cherry Pick All Related Changes in Master Branch
41+
if: ${{ steps.check.outputs.valid }}
42+
run: |
43+
git checkout gh-pages
44+
git checkout -b topic/github-action/update-gh-pages-$(date +'%Y%m%d')
45+
git checkout ${{ steps.check.outputs.latest_tag }} README.md index.yaml charts/* releases/* docs/*
46+
git add README.md index.yaml charts/* releases/* docs/*
47+
git commit -m":book:(docs) cherry-pick docs update from master to gh-pages"
48+
git push -u origin topic/github-action/update-gh-pages-$(date +'%Y%m%d')
49+
50+
- name: Create Pull Request
51+
if: ${{ steps.check.outputs.valid }}
52+
run: |
53+
gh pr create --title ":book:(docs) cherry-pick docs update to gh-pages" \
54+
--body "This PR was created by GitHub Actions to update documentation in gh-pages branch" \
55+
--base gh-pages --head topic/github-action/update-gh-pages-$(date +'%Y%m%d')
56+
env:
57+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)