-
Notifications
You must be signed in to change notification settings - Fork 115
81 lines (73 loc) · 2.63 KB
/
master.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
71
72
73
74
75
76
77
78
79
80
81
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install and Build 🔧
run: |
yarn install
yarn crowdin:sync
yarn build
- name: Build PDF prerequisites 🔨
run: |
sudo apt install fonts-noto -y
curl https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -O
tar zxf prince-14.2-linux-generic-x86_64.tar.gz
cd prince-14.2-linux-generic-x86_64
yes "" | sudo ./install.sh
# https://github.com/signcl/docusaurus-prince-pdf
- name: Generate PDF 🖨️
run: |
yarn serve > /dev/null &
sleep 3s
npx docusaurus-prince-pdf --include-index -u http://localhost:3000/docs/overview --output pdf/Casdoor_Docs.pdf
npx docusaurus-prince-pdf --include-index -u http://localhost:3000/zh/docs/overview --list-only
wget https://gist.githubusercontent.com/Selflocking/7a07d91d34ee227c93d2d8f583f981e3/raw/996a610b96e7e1f42e06ec555528f3427c2fb647/print.css
prince --no-warn-css --style=print.css --input-list=./pdf/localhost-zh-docs-overview.txt -o pdf/Casdoor_Docs_zh.pdf
rm pdf/*.txt
mv pdf/* build/pdf/ -f
- name: Clean up 🧹
run: |
rm -rf prince-14.2-linux-generic-x86_64*
yarn cache clean
npm cache clean --force
sudo apt-get clean
- name: Upload results 📤
uses: actions/upload-artifact@v3
with:
name: PDFs
path: build/pdf/
if-no-files-found: error
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
git-config-name: ${{ secrets.GH_NAME }}
git-config-email: ${{ secrets.GH_EMAIL }}
repository-name: casdoor/casdoor.github.io
branch: master # The deploy branch.
folder: build # The deploy folder.