-
Notifications
You must be signed in to change notification settings - Fork 38
117 lines (101 loc) · 3.78 KB
/
openrpc-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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: OpenRPC (Build & Deploy GitHub pages)
on:
push:
branches:
- main
paths:
- core/rpc/src/api/**
- .github/workflows/openrpc-docs.yml
workflow_dispatch:
jobs:
deploy:
name: Create RPC Docs
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs/rpc
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Build RPC Docs
run: cargo run --bin generate-openrpc-spec -- --write-to .
- name: Install open-rpc
run: npm install -g @open-rpc/generator
- name: Update Openrpc (JSON)
run: open-rpc-generator generate -c openrpc.json
- name: Generate OpenRPC Site (Gatsby)
run: open-rpc-generator generate -t docs -d openrpc.json -l gatsby
- name: Setup config
working-directory: ./docs/rpc/docs/gatsby
run: |
echo "module.exports = {
pathPrefix: 'lightning',
siteMetadata: {
title: 'Fleek Network JSON-RPC',
description: 'This API enables JSON-RPC interaction with Fleek Network Node',
logoUrl: 'https://raw.githubusercontent.com/open-rpc/design/master/icons/open-rpc-logo-noText/open-rpc-logo-noText%20(PNG)/256x256.png',
primaryColor: '#3f51b5', //material-ui primary color
secondaryColor: '#f50057', //material-ui secondary color
author: '',
menuLinks: [
{
name: 'home',
link: '/',
ignoreNextPrev: true
},
{
name: 'API Documentation',
link: '/api-documentation'
}
],
footerLinks: [
{
name: 'OpenRPC',
link: 'https://open-rpc.org'
}
]
},
plugins: [
'@xops.net/gatsby-openrpc-theme',
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'pristine-site',
short_name: 'pristine-site',
start_url: '/',
background_color: 'transparent',
theme_color: '#3f51b5',
display: 'minimal-ui',
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
},
}
],
}" > gatsby-config.js
- name: Install dependencies
working-directory: ./docs/rpc/docs/gatsby
run: |
npm i [email protected] [email protected] -S
npm i [email protected] -S
npm install --force
- name: Fix paths
working-directory: ./docs/rpc/docs/gatsby
# fix: 🐛 support gatsby path prefix https://github.com/open-rpc/generator/pull/708
run: sed -i 's|href="/api-documentation"|href="/lightning/api-documentation"|g' src/pages/index.tsx
- name: Build docs
working-directory: ./docs/rpc/docs/gatsby
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
npx gatsby build --prefix-paths
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/rpc/docs/gatsby/public
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com