-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
566 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Deploy TypeDoc to GitBook | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
env: | ||
NODE_VERSION: 18.x | ||
ENTRY_FILE: "packages" | ||
CONFIG_PATH: "tsconfig.base.json" | ||
USES_PNPM: "true" | ||
|
||
jobs: | ||
deploy: | ||
concurrency: ci-${{ github.ref }} | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
|
||
- name: Install dependencies | ||
run: pnpm install --no-frozen-lockfile | ||
|
||
- name: Build project | ||
run: pnpm build | ||
|
||
- name: Build documentation | ||
run: pnpm docs:generate-markdown | ||
|
||
- name: Deploy to GitBook | ||
run: | | ||
git clone --branch=git-book https://github.com/near/near-sdk-js.git book | ||
rsync -av --delete markdown-docs/ book/ | ||
cd book | ||
git config user.name "GitHub Actions" | ||
git config user.email "actions@github.com" | ||
git add . | ||
git commit -m "Update documentation [skip ci]" | ||
git push https://frol:${{ secrets.MY_GITHUB_TOKEN }}@github.com/near/near-sdk-js.git git-book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { readFileSync, writeFileSync, unlinkSync } = require("fs"); | ||
const { execSync } = require("child_process"); | ||
|
||
// Load the base configuration from typedoc.json | ||
const baseConfig = JSON.parse(readFileSync("./typedoc.json", "utf8")); | ||
|
||
// Extend the base configuration for Markdown documentation | ||
const markdownConfig = { | ||
...baseConfig, | ||
githubPages: false, | ||
out: "markdown-docs", | ||
plugin: ["typedoc-plugin-markdown"], | ||
}; | ||
|
||
// Write the extended configuration to a temporary file | ||
const configFilePath = "./typedoc-markdown.json"; | ||
writeFileSync(configFilePath, JSON.stringify(markdownConfig, null, 2)); | ||
|
||
// Run TypeDoc with the extended configuration | ||
try { | ||
execSync(`npx typedoc --options ${configFilePath}`, { stdio: "inherit" }); | ||
} finally { | ||
// Clean up the temporary file | ||
unlinkSync(configFilePath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.