-
-
Notifications
You must be signed in to change notification settings - Fork 22
79 lines (70 loc) · 2.3 KB
/
gh-pages.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
name: Github Pages 🌐
on:
push:
branches:
- 'master'
paths-ignore:
- '.github/ISSUE_TEMPLATE/*'
- '*.md'
- '*.nimble'
- '.gitignore'
- 'LICENSE'
- '**/FUNDING.yml'
- '**/tests.yml'
- '**/examples.yml'
- '**/language_bindings.yml'
- '**/jvm_bindings.yml'
permissions:
contents: write
jobs:
docs:
runs-on: ubuntu-latest
env:
nim_version: '2.0.6'
node_version: '20'
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.node_version }}
- name: Install uglify-js 👀
run: |
npm install uglify-js -g
- name: Install Nim 👑
run: |
sudo apt install xz-utils
curl https://nim-lang.org/download/nim-${{ env.nim_version }}-linux_x64.tar.xz --output nim.tar.xz
unxz nim.tar.xz
tar -xf nim.tar
sudo mkdir -p /home/.nimble
sudo mv -if nim-${{ env.nim_version }}/* /home/.nimble/
export PATH=/home/.nimble/bin:$PATH
nim -v
nimble refresh
nimble install -y
nimble install nimpy -y
- name: Generate API documents 📃
run: |
export PATH=/home/.nimble/bin:$PATH
nim doc --index:on -d:docgen --project --out:docs --hints:off src/happyx.nim
- name: Build HappyX website 🌐
timeout-minutes: 2
run: |
export PATH=/home/.nimble/bin:$PATH
cd ./examples/website/src/
nim js -d:production -d:release --opt:size --hints:off --warnings:off --out:main_full.js main
uglifyjs main_full.js -c -m --mangle-props regex=/N[ST]I\w+/ -o main.js
cd ../../..
mkdir ./docs/happyx/public/
mkdir ./docs/public/
cp ./examples/website/src/index.html ./docs/
cp ./examples/website/src/main.js ./docs/
cp ./examples/website/src/happyx/public/* ./docs/happyx/public/
cp ./examples/website/src/happyx/public/* ./docs/public/
- name: Deploy documents 💨
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
if: github.ref == 'refs/heads/master'