Skip to content

Commit 4b55846

Browse files
authored
Add ci for trigger tutorial sync (eunomia-bpf#61)
1 parent 1bbe35f commit 4b55846

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/trigger-sync.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test and trigger downstream tutorial sync
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
trigger:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout website repo
15+
uses: actions/checkout@v3
16+
with:
17+
repository: ${{ github.repository_owner }}/eunomia.dev
18+
ref: main
19+
path: ./.
20+
21+
- name: Checkout main repository
22+
uses: actions/checkout@v3
23+
with:
24+
repository: ${{ github.repository_owner }}/eunomia-bpf
25+
ref: master
26+
path: eunomia-bpf
27+
28+
- name: Checkout this repository
29+
uses: actions/checkout@v3
30+
with:
31+
repository: ${{ github.repository_owner }}/bpf-developer-tutorial
32+
ref: ${{ github.ref }}
33+
path: tutorial
34+
35+
- name: Change suffix
36+
run: |
37+
find ./tutorial -type f -name "*.md" ! -name "*_en*" -exec bash -c 'mv "$1" "${1%.md}.zh.md"' bash {} \;
38+
find ./tutorial -type f -name "*_en*.md" -exec bash -c 'mv "$1" "${1//_en/}"' bash {} \;
39+
40+
- name: Merge changes
41+
run: |
42+
cp -rf eunomia-bpf/documents/src docs
43+
mkdir docs/tutorials
44+
cp -rf tutorial/src/* docs/tutorials
45+
mv tutorial/README.zh.md docs/tutorials/SUMMARY.zh.md
46+
mv tutorial/README.md docs/tutorials/SUMMARY.md
47+
mv tutorial/src/SUMMARY.zh.md docs/tutorials/index.zh.md
48+
mv tutorial/src/SUMMARY.md docs/tutorials/index.md
49+
50+
- uses: actions/setup-python@v4
51+
with:
52+
python-version: 3.x
53+
54+
- name: Install dependents
55+
run: |
56+
pip install mkdocs-material=="9.*" mkdocs-static-i18n=="0.53"
57+
58+
- name: Test page build
59+
run: |
60+
mkdocs build -v
61+
62+
- name: Trigger sync workflow
63+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
64+
uses: peter-evans/repository-dispatch@v2
65+
with:
66+
token: ${{ secrets.PAT }}
67+
repository: ${{ github.repository_owner }}/eunomia.dev
68+
event-type: trigger-tutorial-sync

0 commit comments

Comments
 (0)