Skip to content

Commit

Permalink
Merge pull request #669 from 128technology/jbog/offline-docs
Browse files Browse the repository at this point in the history
Add knobs to build documentation for "offline" mode
  • Loading branch information
thedillonb authored Feb 5, 2024
2 parents f2b7e9f + 2b088df commit 37319e4
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 9 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
Expand All @@ -40,7 +40,12 @@ jobs:
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: npm run build


- name: Build Offline Bundle
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: npm run build:offline

- name: Broken Link Checker Action
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

name: Build and Release

permissions:
contents: write

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Build Bundle
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: npm run build

- name: Zip Bundle
run: zip -qr build build/

- name: Build Offline Bundle
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: npm run build:offline

- name: Zip Offline Bundle
run: zip -qr offline-docs offline-docs/

- name: Publish Release
uses: ncipollo/release-action@v1
with:
tag: "${{ github.ref_name }}"
body: 'SSR ${{ github.ref_name }} Documentation'
artifacts: "*.zip"
prerelease: true
allowUpdates: true
artifactErrorsFailBuild: true
29 changes: 22 additions & 7 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
title: 'SSN Docs',
tagline: 'The documentation source for the Session Smart Networking Platform',
url: 'https://docs.128technology.com',
baseUrl: '/',
baseUrl: process.env.OFFLINE_DOCS ? '/offline-docs/' : '/',
favicon: 'img/favicon.png',
organizationName: '128technology', // Usually your GitHub org/user name.
projectName: 'docs', // Usually your repo name.
Expand All @@ -27,7 +27,11 @@ module.exports = {
srcDark: 'img/logo_dark.png',
},
items: [
{to: 'docs/intro_getting_started', label: 'Docs', position: 'right'},
{
to: 'docs/intro_getting_started',
label: 'Docs',
position: 'right',
},
{
href: 'https://community.juniper.net/answers/communities/community-home?CommunityKey=310d1a41-12fa-4627-9a99-880145a7c87c',
label: 'Community',
Expand Down Expand Up @@ -59,14 +63,25 @@ module.exports = {
},
],
],
plugins: [
'./src/plugins/release-notes-api.js',
],
plugins: ['./src/plugins/release-notes-api.js'],
customFields: {
marvisSearch: {
docSource: "128t",
docSource: '128t',
numResults: 15,
proxyURL: 'https://raq48a0wrg.execute-api.us-east-1.amazonaws.com/prod/marvis_docs_api_proxy',
proxyURL:
'https://raq48a0wrg.execute-api.us-east-1.amazonaws.com/prod/marvis_docs_api_proxy',
},
},
};

if (process.env.OFFLINE_DOCS) {
module.exports.themeConfig.announcementBar = {
id: 'offline_docs',
content:
'You are viewing a local version of this documentation. ' +
'For the most up-to-date information please visit the <a target="_blank" href="https://docs.128technology.com/">online documentation</a>',
backgroundColor: '#eed202',
textColor: '#000',
isCloseable: true,
};
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"private": true,
"scripts": {
"start": "docusaurus start --host 0.0.0.0",
"serve": "docusaurus serve",
"build": "docusaurus build",
"build:offline": "OFFLINE_DOCS=1 docusaurus build --out-dir=offline-docs",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"ci": "yarn lint && yarn prettier:diff",
Expand Down

0 comments on commit 37319e4

Please sign in to comment.