-
Notifications
You must be signed in to change notification settings - Fork 8
50 lines (48 loc) · 1.64 KB
/
publish-docs.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
name: publish to easyabp.io
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: \]\((/docs/)
replace: "](/modules/${{ github.event.repository.name }}/"
include: docs/**.md
- name: Pull repo and change files
id: change
run: |
ls
git clone https://github.com/EasyAbp/easyabp.github.io
cd easyabp.github.io
rm -rf docs/modules/${{ github.event.repository.name }}
rm -rf docs/.vuepress/public/modules/${{ github.event.repository.name }}
cp -rf ../docs/ docs/modules/${{ github.event.repository.name }}
cp -rf ../docs/ docs/.vuepress/public/modules/${{ github.event.repository.name }}
git add --all
echo "##[set-output name=diff;]$(git diff --staged)"
- name: Commit files
if: steps.change.outputs.diff
run: |
ls
cd easyabp.github.io
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update the docs of ${{ github.event.repository.name }}" -a
- name: Push changes
if: steps.change.outputs.diff
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.EASYABP_IO_ACCESS_TOKEN }}
repository: EasyAbp/easyabp.github.io
directory: easyabp.github.io