-
Notifications
You must be signed in to change notification settings - Fork 57
54 lines (45 loc) · 1.29 KB
/
deploy-to-wiki.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (c) 2020-2022 Morwenn
# SPDX-License-Identifier: MIT
name: Wiki Deployment
on:
push:
branches:
- master
paths:
- 'docs/**'
jobs:
sync-wiki-files:
name: Sync Wiki Files
runs-on: ubuntu-latest
steps:
- name: Checkout /docs
uses: actions/checkout@v3
with:
repository: ${{github.repository}}
path: main
- name: Checkout wiki
uses: actions/checkout@v3
with:
repository: ${{github.repository}}.wiki
path: wiki
- name: Sync wiki files
run: |
for docname in main/docs/*.md; do
old=$(basename "$docname");
new=${old%.*};
find main/docs -name "*.md" -exec sed -i "s/$old/$new/g" {} \;
done
rsync -avzr --delete --exclude='.git/' "main/docs/" "wiki/"
- name: Commit changes
working-directory: wiki
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Synchronize wiki with docs/"
- name: Push changes to wiki
uses: ad-m/github-push-action@master
with:
directory: wiki
repository: ${{github.repository}}.wiki
branch: master