Skip to content

Commit

Permalink
add build static
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-kotulski committed Jan 10, 2025
1 parent 3e6987b commit ddf27c2
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 71 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-build
cancel-in-progress: true
build-router:
uses: ./.github/workflows/workflow-build-router.yml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-router
cancel-in-progress: true
build-static:
uses: ./.github/workflows/workflow-build-static.yml
45 changes: 0 additions & 45 deletions .github/workflows/workflow-build-router.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/workflow-build-static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build static documentation

on:
workflow_call:

jobs:
language_matrix:
strategy:
matrix:
language: ["en", "fr", "es", "ja", "pt"]
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Build
run: |
if [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build -- --locale ${{ matrix.language }}
env:
DOCUSAURUS_LANGUAGE: ${{ matrix.language }}
DOCUSAURUS_ROUTER: 'hash'
- uses: actions/upload-artifact@v4
with:
path: ./build
name: build-${{ matrix.language }}
48 changes: 27 additions & 21 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,32 @@ const darkTheme = themes.palenight;

const isProduction = process.env.GITHUB_REPOSITORY_OWNER === '4d';
const router = process.env.DOCUSAURUS_ROUTER
const isStatic = process.env.DOCUSAURUS_ROUTER === "hash"
const language = process.env.DOCUSAURUS_LANGUAGE ?? "en"

const locales = isStatic ? [language] : ["en", "fr", "es", "ja", "pt"]
const localeConfigs = isStatic ? {} : {
en: {
label: "English",
},
fr: {
label: "Français",
},
es: {
label: "Español",
},
ja: {
label: "日本語",
},
pt: {
label: "Português",
},
}

module.exports = {
title: "4D Docs",
tagline: "Documentation for 4D developers",
baseUrl: router ? "" : "/docs/",
baseUrl: isStatic ? "/" : "/docs/",
//url: "https://4d.github.io/",
url: "https://developer.4d.com/",
organizationName: "4D",
Expand Down Expand Up @@ -82,25 +104,9 @@ module.exports = {
experimental_router: router,
},
i18n: {
defaultLocale: "en",
locales: ["en", "fr", "es", "ja", "pt"],
localeConfigs: {
en: {
label: "English",
},
fr: {
label: "Français",
},
es: {
label: "Español",
},
ja: {
label: "日本語",
},
pt: {
label: "Português",
},
},
defaultLocale: language,
locales: locales,
localeConfigs: localeConfigs,
},
plugins: [
[
Expand Down Expand Up @@ -251,5 +257,5 @@ module.exports = {
maintainCase: false,
},
},
themes: ['@docusaurus/theme-mermaid'],
themes: ['@docusaurus/theme-mermaid'],
}

0 comments on commit ddf27c2

Please sign in to comment.