Skip to content

Commit ffc80c0

Browse files
authored
Initial workflow, refs #1
1 parent e4bdd17 commit ffc80c0

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/stable-docs.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Update Stable Docs
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
update_stable_docs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Git user
21+
run: |
22+
git config user.name "Automated"
23+
git config user.email "[email protected]"
24+
25+
- name: Check if stable-docs branch exists
26+
run: |
27+
if ! git rev-parse --verify stable-docs > /dev/null 2>&1; then
28+
git checkout -b stable-docs
29+
git push -u origin stable-docs
30+
fi
31+
32+
- name: Handle Release
33+
if: github.event_name == 'release'
34+
run: |
35+
git fetch --all
36+
git checkout stable-docs
37+
git reset --hard ${GITHUB_REF#refs/tags/}
38+
git push origin stable-docs --force
39+
40+
- name: Handle Commit to Main
41+
if: contains(github.event.head_commit.message, '!stable-docs')
42+
run: |
43+
git fetch --all
44+
git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep '^docs/' > changes.txt
45+
if [[ -s changes.txt ]]; then
46+
git checkout stable-docs
47+
git checkout ${{ github.sha }} -- $(cat changes.txt)
48+
git commit -m "Cherry-picked docs changes from ${{ github.sha }}"
49+
git push origin stable-docs
50+
fi

0 commit comments

Comments
 (0)