Skip to content

Add ci for trigger tutorial sync #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/trigger-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test and trigger downstream tutorial sync

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Checkout website repo
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/eunomia.dev
ref: main
path: ./.

- name: Checkout main repository
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/eunomia-bpf
ref: master
path: eunomia-bpf

- name: Checkout this repository
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/bpf-developer-tutorial
ref: ${{ github.ref }}
path: tutorial

- name: Change suffix
run: |
find ./tutorial -type f -name "*.md" ! -name "*_en*" -exec bash -c 'mv "$1" "${1%.md}.zh.md"' bash {} \;
find ./tutorial -type f -name "*_en*.md" -exec bash -c 'mv "$1" "${1//_en/}"' bash {} \;

- name: Merge changes
run: |
cp -rf eunomia-bpf/documents/src docs
mkdir docs/tutorials
cp -rf tutorial/src/* docs/tutorials
mv tutorial/README.zh.md docs/tutorials/SUMMARY.zh.md
mv tutorial/README.md docs/tutorials/SUMMARY.md
mv tutorial/src/SUMMARY.zh.md docs/tutorials/index.zh.md
mv tutorial/src/SUMMARY.md docs/tutorials/index.md

- uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Install dependents
run: |
pip install mkdocs-material=="9.*" mkdocs-static-i18n=="0.53"

- name: Test page build
run: |
mkdocs build -v

- name: Trigger sync workflow
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: ${{ github.repository_owner }}/eunomia.dev
event-type: trigger-tutorial-sync