Skip to content

Commit

Permalink
Only build last 3 versions of user-guide for staging (#4072)
Browse files Browse the repository at this point in the history
* Only build last 3 versions of user-guide for staging

- To speed it up a bit
- Also remove sed'ing of docusaurus.config.js, read env vars instead

* actually export vars
  • Loading branch information
foot authored Oct 17, 2023
1 parent ff77b2f commit b954e44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ jobs:
else
npm i
fi
sed -i 's#url:.*$#url: "https://staging.docs.gitops.weave.works",#' docusaurus.config.js
sed -i "s#baseUrl:.*\$#baseUrl: \"/$GITHUB_HEAD_REF/\",#" docusaurus.config.js
yarn clear
export DOC_BASE_URL="/$GITHUB_HEAD_REF/"
export DOC_URL=https://staging.docs.gitops.weave.works
export STAGING_BUILD=true
npm run build
- id: auth
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1
Expand Down
13 changes: 11 additions & 2 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const versions = require("./versions.json");
module.exports = {
title: "Weave GitOps",
tagline: "The Flux expansion pack from the founders of Flux",
url: "https://docs.gitops.weave.works",
baseUrl: "/",
url: process.env.DOC_URL || "https://docs.gitops.weave.works",
baseUrl: process.env.DOC_BASE_URL || "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon_150px.png",
Expand Down Expand Up @@ -187,6 +187,15 @@ module.exports = {
id: 'default',
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/weaveworks/weave-gitops/edit/main/website",
onlyIncludeVersions: (() => {
if (process.env.STAGING_BUILD === "true") {
// Build the last 3 versions for staging to speed it up a bit
return ["current", ...versions.slice(0, 3)];
}

// Return undefined which will fall back to the default of all versions
return undefined;
})(),
disableVersioning: process.env.DISABLE_VERSIONING === "true",
},
blog: {
Expand Down

0 comments on commit b954e44

Please sign in to comment.