Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
docusaurus_pr_number:
required: false
type: number
default: -1
docusaurus_pr_url:
required: false
type: string
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
description: AWS S3 prefix where to store the build.
required: true
type: string
cf_invalidate_path:
description: Path to invalidate on CloudFront after deployment.
required: true
type: string

concurrency: deploy-${{ github.ref }}

Expand Down Expand Up @@ -64,4 +68,4 @@ jobs:
--paths ${PATH_TO_INVALIDATE}
env:
CF_DISTRIBUTION_ID: ${{ vars.CF_DISTRIBUTION_ID }}
PATH_TO_INVALIDATE: '/${{ inputs.s3_prefix }}*'
PATH_TO_INVALIDATE: ${{ inputs.cf_invalidate_path }}
6 changes: 5 additions & 1 deletion .github/workflows/_undeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
description: AWS S3 prefix where the build is located.
required: true
type: string
cf_invalidate_path:
description: Path to invalidate on CloudFront after deployment.
required: true
type: string

concurrency: deploy-${{ github.ref }}

Expand Down Expand Up @@ -45,4 +49,4 @@ jobs:
--paths ${PATH_TO_INVALIDATE}
env:
CF_DISTRIBUTION_ID: ${{ vars.CF_DISTRIBUTION_ID }}
PATH_TO_INVALIDATE: '/${{ inputs.s3_prefix }}*'
PATH_TO_INVALIDATE: ${{ inputs.cf_invalidate_path }}
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ jobs:
environment_name: production
artifact_name: ${{ needs.build.outputs.artifact_name }}
s3_prefix: 'docs'
cf_invalidate_path: '/*'
2 changes: 2 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
environment_url: '${{ vars.PREVIEW_CLOUDFRONT_URL }}/pr-${{ github.event.number }}/'
artifact_name: ${{ needs.build.outputs.artifact_name }}
s3_prefix: 'pr-${{ github.event.number }}'
cf_invalidate_path: '/pr-${{ github.event.number }}*'

undeploy:
name: undeploy
Expand All @@ -49,3 +50,4 @@ jobs:
with:
environment_name: preview
s3_prefix: 'pr-${{ github.event.number }}'
cf_invalidate_path: '/pr-${{ github.event.number }}*'
31 changes: 17 additions & 14 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ const docsConfigBase = {
} satisfies DocsPlugin.Options;

// Remove the index.md[x] from categories
function removeDocIndexItems(items) {
function removeDocIndexItems(items: any) {
const result = items
.filter((item) => item.type !== 'doc' || !item.id.endsWith('/index'))
.map((item) => {
.filter((item: any) => item.type !== 'doc' || !item.id.endsWith('/index'))
.map((item: any) => {
if (item.type === 'category') {
return { ...item, items: removeDocIndexItems(item.items) };
}
Expand All @@ -96,6 +96,8 @@ function removeDocIndexItems(items) {
return result;
}

const PR_NUMBER = Number(process.env.DOCUSAURUS_PR_NUMBER ?? -1);

const config: Config = {
title: 'Dolby OptiView Documentation',
tagline: 'Discover the latest developer documentation and samples for OptiView products',
Expand Down Expand Up @@ -453,7 +455,7 @@ const config: Config = {
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params);
const { frontMatter } = result;
const parsedDocPath = parseDocPath(params.filePath);
const parsedDocPath = parseDocPath(params.filePath)!;
const { docPluginId } = parsedDocPath;
let { docPath } = parsedDocPath;
if (!frontMatter.slug && docPath.startsWith('external/')) {
Expand Down Expand Up @@ -535,18 +537,19 @@ const config: Config = {
// image: 'img/opengraph.png',

// announcement bar for PR preview only
announcementBar: process.env.DOCUSAURUS_PR_NUMBER
? {
id: 'pr_preview',
content: `This is a preview of the documentation website from <a target="_blank" rel="noopener noreferrer" href="${process.env.DOCUSAURUS_PR_URL}">pull request #${process.env.DOCUSAURUS_PR_NUMBER}</a>.`,
backgroundColor: '#9cb9c9',
textColor: '#344a5e',
isCloseable: false,
}
: undefined,
announcementBar:
PR_NUMBER > 0
? {
id: 'pr_preview',
content: `This is a preview of the documentation website from <a target="_blank" rel="noopener noreferrer" href="${process.env.DOCUSAURUS_PR_URL}">pull request #${process.env.DOCUSAURUS_PR_NUMBER}</a>.`,
backgroundColor: '#9cb9c9',
textColor: '#344a5e',
isCloseable: false,
}
: undefined,

navbar: {
title: null,
title: undefined,
logo: {
alt: 'Dolby OptiView',
src: 'img/dolby-optiview-white.svg',
Expand Down