forked from JackboxUtility/JackboxUtility
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (75 loc) · 2.77 KB
/
generate_server_doc.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
on:
push:
branches: [ dev ]
name: Generate server documentations
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
create-release-notes:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install json-schema-static-docs
- run: touch index.js
- working-directory: ./documentation/server
run: |
echo "const JsonSchemaStaticDocs = require('json-schema-static-docs');
(async () => {
let jsonSchemaStaticDocs = new JsonSchemaStaticDocs({
inputPath: 'schema',
outputPath: 'docs',
ajvOptions: {
allowUnionTypes: true,
},
});
await jsonSchemaStaticDocs.generate();
console.log('Documents generated.');
})();" > index.js
- run: node index.js
working-directory: ./documentation/server
- run: |
echo "function Link(el)
el.target = string.gsub(el.target,'.md', '.html')
return el
end" > links-to-html.lua
working-directory: ./documentation/server
- run: sudo apt-get install pandoc
working-directory: ./documentation/server
- run : echo $(curl https://raw.githubusercontent.com/sindresorhus/github-markdown-css/main/github-markdown-light.css) | sed "s/.markdown-//g" > markdowncss.css
working-directory: ./documentation/server/docs
- run: cp markdowncss.css packs
working-directory: ./documentation/server/docs
- run: cp markdowncss.css welcome
working-directory: ./documentation/server/docs
- run: for i in $(find docs -name "*.md"); do pandoc -f markdown -t html -s "$i" --css markdowncss.css --lua-filter=links-to-html.lua > "${i/.md/.html}"; done;
working-directory: ./documentation/server
- run : find docs -name "*.md" | xargs rm
working-directory: ./documentation/server
- uses: actions/upload-artifact@v3
with:
name: documentation
path: ./documentation/server/docs
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: './documentation/server/docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2