| 1 | name: sync-wiki |
| 2 | on: |
| 3 | push: |
| 4 | branches: [master] |
| 5 | paths: |
| 6 | - '.github/workflows/sync-wiki.yml' |
| 7 | - 'docs/**' |
| 8 | concurrency: |
| 9 | group: sync-wiki-${{ github.ref }} |
| 10 | cancel-in-progress: true |
| 11 | |
| 12 | permissions: |
| 13 | contents: read |
| 14 | |
| 15 | jobs: |
| 16 | sync-wiki: |
| 17 | permissions: |
| 18 | contents: write # for Git to git push |
| 19 | runs-on: ubuntu-latest |
| 20 | steps: |
| 21 | - uses: actions/checkout@v4 |
| 22 | - name: sync |
| 23 | run: | |
| 24 | cp -r docs $GITHUB_WORKSPACE/ncnn.wiki |
| 25 | cd $GITHUB_WORKSPACE/ncnn.wiki |
| 26 | git config --global user.name "wiki-sync-bot" |
| 27 | git config --global user.email "wiki-sync-bot@qq.com" |
| 28 | git init |
| 29 | git add . |
| 30 | git commit -m "sync" |
| 31 | git remote add upstream https://${{ secrets.WIKI_SYNC_BOT_TOKEN }}@github.com/Tencent/ncnn.wiki.git |
| 32 | git push upstream master -f |