Skip to content

Commit b640b46

Browse files
authored
ci: update api automatisation (#81)
1 parent f3bbf6c commit b640b46

File tree

152 files changed

+107
-10440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+107
-10440
lines changed

.github/workflows/check.yaml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,45 @@ jobs:
1212
check:
1313
runs-on: ubuntu-latest
1414

15-
strategy:
16-
matrix:
17-
node-version: [14.x]
18-
1915
steps:
2016
- uses: actions/checkout@v2
2117
with:
2218
fetch-depth: 0
23-
- name: Use Node.js ${{ matrix.node-version }}
19+
submodules: true
20+
21+
- name: Use Node.js 16
2422
uses: actions/setup-node@v1
2523
with:
26-
node-version: ${{ matrix.node-version }}
24+
node-version: '16'
2725

28-
## Try getting the node modules from cache, if failed npm ci
26+
# Cache for the node_modules of Bee JS Docs
2927
- uses: actions/cache@v2
30-
id: cache-npm
28+
id: cache-docs-npm
3129
with:
3230
path: node_modules
33-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
31+
key: ${{ runner.os }}-docs-${{ hashFiles('./package-lock.json') }}
3432
restore-keys: |
35-
${{ runner.OS }}-node-${{ env.cache-name }}-
36-
${{ runner.OS }}-node-
37-
${{ runner.OS }}-
38-
- name: Install npm deps
39-
if: steps.cache-npm.outputs.cache-hit != 'true'
33+
${{ runner.OS }}-docs-${{ env.cache-name }}-
34+
${{ runner.OS }}-docs-
35+
36+
- name: Install npm deps for Bee JS Docs
37+
if: steps.cache-docs-npm.outputs.cache-hit != 'true'
4038
run: npm ci
4139

40+
# Cache for the node_modules of Bee JS
41+
- uses: actions/cache@v2
42+
id: cache-bee-js-npm
43+
with:
44+
path: bee-js/node_modules
45+
key: ${{ runner.os }}-bee-js-${{ hashFiles('./bee-js/package-lock.json') }}
46+
restore-keys: |
47+
${{ runner.OS }}-bee-js-${{ env.cache-name }}-
48+
${{ runner.OS }}-bee-js-
49+
50+
- name: Install npm deps for Bee-js
51+
if: steps.cache-bee-js-npm.outputs.cache-hit != 'true'
52+
run: cd bee-js && npm ci && cd ..
53+
4254
- name: Commit linting
4355
uses: wagoid/commitlint-github-action@v2
4456

.github/workflows/gh-pages.yaml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,43 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
with:
16-
fetch-depth: 0
16+
submodules: true
1717

1818
- uses: actions/setup-node@v1
1919
with:
20-
node-version: '14'
20+
node-version: '16'
21+
22+
# Cache for the node_modules of Bee JS Docs
23+
- uses: actions/cache@v2
24+
id: cache-docs-npm
25+
with:
26+
path: node_modules
27+
key: ${{ runner.os }}-docs-${{ hashFiles('./package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.OS }}-docs-${{ env.cache-name }}-
30+
${{ runner.OS }}-docs-
31+
32+
- name: Install npm deps for Bee JS Docs
33+
if: steps.cache-docs-npm.outputs.cache-hit != 'true'
34+
run: npm ci
35+
36+
# Cache for the node_modules of Bee JS
37+
- uses: actions/cache@v2
38+
id: cache-bee-js-npm
39+
with:
40+
path: bee-js/node_modules
41+
key: ${{ runner.os }}-bee-js-${{ hashFiles('./bee-js/package-lock.json') }}
42+
restore-keys: |
43+
${{ runner.OS }}-bee-js-${{ env.cache-name }}-
44+
${{ runner.OS }}-bee-js-
45+
46+
- name: Install npm deps for Bee-js
47+
if: steps.cache-bee-js-npm.outputs.cache-hit != 'true'
48+
run: cd bee-js && npm ci && cd ..
2149

2250
- name: Build for gh-pages
2351
run: |
24-
npm ci
25-
npm run-script build
52+
npm run build
2653
echo "bee-js.ethswarm.org" > ./build/CNAME
2754
rm ./build/.nojekyll
2855
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update API docs
2+
3+
on:
4+
workflow_dispatch:
5+
repository_dispatch:
6+
types: [trigger-api-docs-pr]
7+
8+
9+
jobs:
10+
create-api-docs-pr:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
17+
- name: Use Node.js 16
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 16.x
21+
22+
- name: Update Bee-js
23+
run: git submodule update --remote --merge
24+
25+
- name: Create PR
26+
uses: gr2m/create-or-update-pull-request-action@v1
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.REPO_GHA_PAT }}
29+
with:
30+
title: "feat: new bee-js api docs"
31+
body: "Updated Bee-js API references"
32+
branch: "feat/new-bee-js-api-docs"
33+
commit-message: "feat: new bee-js api docs"
34+
author: "bee-worker <[email protected]>"

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ node_modules
44
build
55
public
66
resources
7+
78
# Local Netlify folder
8-
.netlify
9+
.netlify
10+
11+
# Generated Bee API docs
12+
docs/api

README.md

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Don't forget to find and replace the version number for the whole of the docs fo
3434

3535
## How to generate / include the API reference html
3636

37-
1. Preparation phase - pull bee-js submodule and update it to the necessary commit
3837
```sh
3938
# Initialise the bee-js submodule
4039
git submodule update --init --recursive
@@ -46,34 +45,10 @@ git submodule update --remote --merge
4645
cd bee-js
4746
npm ci
4847
cd ..
49-
```
50-
51-
2. Generating the docs - in the `docusaurus.config.js` and uncomment the line 9 with `'docusaurus-plugin-typedoc'` in the plugins array.
52-
53-
Build the api docs now with `npm run build`. This will probably throw some syntax errors like:
5448

49+
# Generate new API
50+
npm run build
5551
```
56-
./docs/api/functions/utils.bytes.isbytes.md
57-
SyntaxError: ./bee-js-docs/docs/api/functions/utils.bytes.isbytes.md: Expected corresponding JSX closing tag for <T> (11:39)
58-
59-
9 | <p><a parentName="p" {...{"href":"/docs/api/modules/utils"}}>{`Utils`}</a>{`.`}<a parentName="p" {...{"href":"/docs/api/modules/utils.bytes"}}>{`Bytes`}</a>{`.isBytes`}</p>
60-
10 | <p>{`▸ `}<strong parentName="p">{`isBytes`}</strong>{`<Length`}{`>`}{`(`}<inlineCode parentName="p">{`length`}</inlineCode>{`: Length, `}<inlineCode parentName="p">{`b`}</inlineCode>{`: Uint8Array): b is Bytes<Length`}{`>`}</p>
61-
> 11 | <p>{`Type guard for Bytes`}<T>{` type`}</p>
62-
| ^
63-
12 | <h4 {...{"id":"type-parameters"}}>{`Type parameters:`}</h4>
64-
13 | <table>
65-
14 | <thead parentName="table">
66-
@ ./.docusaurus/registry.js 1:11691-11761 1:11547-11638
67-
@ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
68-
@ ./.docusaurus/routes.js
69-
@ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
70-
@ multi ./node_modules/@docusaurus/core/lib/client/clientEntry.js
71-
Client bundle compiled with errors therefore further build is impossible.
72-
```
73-
74-
3. Fix the issues - run the `escape-chars.bash` script
75-
76-
4. In the `docusaurus.config.js` and comment the line 9 with `'docusaurus-plugin-typedoc'` in the plugins array so that the building no longer runs typedoc on `bee-js`. Test the page with `npm run start` or `npm run build` and create PR with this updated API reference.
7752

7853
## Maintainers
7954

bee-js

docs/api/_category_.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/api/classes/_category_.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)