-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (53 loc) · 1.9 KB
/
Copy pathsync-docs.yml
File metadata and controls
62 lines (53 loc) · 1.9 KB
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
55
56
57
58
59
60
61
name: Sync Docs to `docs/`
on:
push:
branches: [main]
jobs:
copy-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare docs structure
run: |
mkdir -p docs
mkdir -p docs/changelog
mkdir -p docs/contributing
mkdir -p docs/license
- name: Copy and wrap README.md to docs/index.md
run: |
echo "---" > docs/index.md
echo "title: Main" >> docs/index.md
echo "---" >> docs/index.md
cat README.md >> docs/index.md
- name: Copy and wrap CHANGELOG.md to docs/changelog/index.md
run: |
echo "---" > docs/changelog/index.md
echo "title: Changelog" >> docs/changelog/index.md
echo "---" >> docs/changelog/index.md
cat CHANGELOG.md >> docs/changelog/index.md
- name: Copy and wrap LICENSE to docs/license/index.md
run: |
echo "---" > docs/license/index.md
echo "title: License" >> docs/license/index.md
echo "---" >> docs/license/index.md
cat LICENSE >> docs/license/index.md
- name: Copy and wrap CONTRIBUTING.md to docs/contributing/index.md
run: |
echo "---" > docs/contributing/index.md
echo "title: Contributing" >> docs/contributing/index.md
echo "---" >> docs/contributing/index.md
cat CONTRIBUTING.md >> docs/contributing/index.md
- name: Commit and push if docs changed
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add docs/
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Update docs from root files"
git push
fi