-
Notifications
You must be signed in to change notification settings - Fork 1.3k
70 lines (70 loc) · 2.18 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Publish docs
on: [workflow_dispatch]
env:
WORKING_DIRECTORY: ./apps/calendar
jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the package version
id: cpv
uses: PostHog/check-package-version@v2
with:
path: ${{ env.WORKING_DIRECTORY }}
- name: Install dependencies
uses: ./.github/composite-actions/install-dependencies
- name: Update the relative links in README
run: |
PACKAGES=core npm run update:readme
- name: Prebuild docs
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm run docs:prebuild
- name: Change node version to 10
uses: actions/setup-node@v3
with:
node-version: '10'
registry-url: https://registry.npmjs.org/
- name: Install tuidoc
run: |
npm install -g @toast-ui/doc
shell: bash
- name: Build docs
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
tuidoc
shell: bash
- name: Switch branch
run: |
git stash
git switch gh-pages
- name: Remove previous docs
run: |
rm -rf latest
rm -rf ${{ steps.cpv.outputs.committed-version }}
- name: Commit docs
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "Dohyung Ahn"
mv -i _latest ../../latest
mv _${{ steps.cpv.outputs.committed-version }} ../../${{ steps.cpv.outputs.committed-version }}
git add -A
git commit -m ${{ steps.cpv.outputs.committed-version }}
- name: Publish new docs
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
- name: Back to main branch
run: |
git switch main
- name: Restore Node.js version to 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.org/
cache: 'npm'