-
Notifications
You must be signed in to change notification settings - Fork 3
ts(docs): Add typedoc to client hosted with GHPages #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
75b77a3
94ede6f
bde6207
e20eb7d
0f3e429
584cb76
e177ad8
1b8eb0c
8f67500
731ee4c
b387d00
cc49790
93bc209
ff4eaa9
a5d811b
4e3627c
212ac86
0c83364
6736801
73f7aa5
9d7d6f6
dd84836
6eca3ad
7157f4c
6613e07
ee6cabb
586c8f6
a95c309
fd6736c
de19a6f
2cd818c
58454cb
64da58f
3076783
cb5d728
a7f81df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| name: PUBLISH DOCS | ||
| on: | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| release: | ||
| types: [published] | ||
| permissions: | ||
| contents: write # allows the 'Commit' step without tokens | ||
|
|
||
| jobs: | ||
| get_history: # create an artifact from the existing documentation builds | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: get the gh-pages repo | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| ref: gh-pages | ||
|
|
||
| - name: tar the existing docs | ||
| run: | | ||
| mkdir -p ./docs | ||
| tar -cvf documentation.tar ./docs | ||
|
|
||
| - name: create a document artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: documentation | ||
| path: documentation.tar | ||
|
|
||
| build: # builds the distribution and then the documentation | ||
| needs: get_history | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout src | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - run: mkdir -p ./docs | ||
| - name: Download the existing documents artifact | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: documentation | ||
| - run: tar -xf documentation.tar ./docs -C ./docs | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason we want to only untar things that start with ./docs? (probably fine given how the archive is created, but maybe would be confusing if we add more dirs later and they don't show up?)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is just for GH pages so yeah just that one |
||
|
|
||
| - name: Build | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16.x | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run build # set up 'build' script in your package.json | ||
|
|
||
| - name: Build documents | ||
| run: npm run docs #set up 'docs' build script in your package.json | ||
|
|
||
| - name: tar the new docs | ||
| run: tar -cvf newdocumentation.tar ./docs | ||
|
|
||
| - name: create a new document artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: newdocumentation | ||
| path: newdocumentation.tar | ||
|
|
||
| commit: # commit the old and new merged documents to gh-pages/docs | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: checkout the gh-pages repo | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| ref: gh-pages | ||
|
|
||
| - run: mkdir -p ./docs | ||
| - name: Download the new documents artifact | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: newdocumentation | ||
| - run: tar -xf newdocumentation.tar ./docs -C ./docs | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment here on the ./docs arg |
||
|
|
||
| - name: commit | ||
| run: | | ||
| git config --global user.email "username@users.noreply.github.com" | ||
| git config --global user.name "Continuous Integration" | ||
| git add . | ||
| git commit -m "CI updated the documentation" | ||
| git push | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,3 +12,4 @@ dist-deno | |
| .DS_Store | ||
| coverage-objects | ||
| object-coverage-report.json | ||
| docs | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const indexJs = | ||
| const sdkJs = | ||
| process.env['DIST_PATH'] ? | ||
| path.resolve(process.env['DIST_PATH'], 'index.js') | ||
| : path.resolve(__dirname, '..', '..', 'dist', 'index.js'); | ||
| path.resolve(process.env['DIST_PATH'], 'sdk.js') | ||
| : path.resolve(__dirname, '..', '..', 'dist', 'sdk.js'); | ||
|
|
||
| let before = fs.readFileSync(indexJs, 'utf8'); | ||
| let before = fs.readFileSync(sdkJs, 'utf8'); | ||
| let after = before.replace( | ||
| /^\s*exports\.default\s*=\s*(\w+)/m, | ||
| 'exports = module.exports = $1;\nexports.default = $1', | ||
| ); | ||
| fs.writeFileSync(indexJs, after, 'utf8'); | ||
| fs.writeFileSync(sdkJs, after, 'utf8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is no .docs dir, should we create an error rather than an empty tar file? I assume things would just fail if the tar command exits with nonzero status, so just taking out the mkdir would do the trick?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is within the GH page repo, so if it doesn't exist it makes an empty one if it does it tars it up