From 774e0e066fe25cf6e708fdfd8305d64047ada045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Kivim=C3=A4ki?= Date: Thu, 21 Sep 2023 13:33:32 +0300 Subject: [PATCH] Split documentation pages and site --- .github/workflows/deploy-docs.yml | 19 ++++++++++++------- Taskfile.yml | 8 ++------ docs/.gitignore | 15 ++------------- docs/pages | 1 + docs/{ => site}/README.md | 0 docs/{ => site}/Taskfile.yml | 21 ++++++++++++++------- docs/{ => site}/babel.config.js | 0 docs/{ => site}/docs/api.md | 0 docs/{ => site}/docs/contributing.md | 0 docs/{ => site}/docs/installation.md | 0 docs/{ => site}/docs/intro.md | 0 docs/{ => site}/docs/usage.md | 0 docs/{ => site}/docusaurus.config.js | 0 docs/{ => site}/package-lock.json | 0 docs/{ => site}/package.json | 0 docs/{ => site}/sidebars.js | 0 docs/{ => site}/src/components/.gitkeep | 0 docs/{ => site}/src/css/custom.css | 0 docs/{ => site}/src/pages/.gitkeep | 0 docs/{ => site}/static/.nojekyll | 0 docs/{ => site}/static/img/logo.png | Bin docs/{ => site}/static/img/logo.svg | 0 22 files changed, 31 insertions(+), 33 deletions(-) create mode 120000 docs/pages rename docs/{ => site}/README.md (100%) rename docs/{ => site}/Taskfile.yml (55%) rename docs/{ => site}/babel.config.js (100%) rename docs/{ => site}/docs/api.md (100%) rename docs/{ => site}/docs/contributing.md (100%) rename docs/{ => site}/docs/installation.md (100%) rename docs/{ => site}/docs/intro.md (100%) rename docs/{ => site}/docs/usage.md (100%) rename docs/{ => site}/docusaurus.config.js (100%) rename docs/{ => site}/package-lock.json (100%) rename docs/{ => site}/package.json (100%) rename docs/{ => site}/sidebars.js (100%) rename docs/{ => site}/src/components/.gitkeep (100%) rename docs/{ => site}/src/css/custom.css (100%) rename docs/{ => site}/src/pages/.gitkeep (100%) rename docs/{ => site}/static/.nojekyll (100%) rename docs/{ => site}/static/img/logo.png (100%) rename docs/{ => site}/static/img/logo.svg (100%) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 07ba22a9..4e28044a 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -21,11 +21,21 @@ jobs: with: go-version: "1.21" + - name: Setup Golang caches + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-golang-${{ hashFiles('go.sum') }} + restore-keys: | + ${{ runner.os }}-golang- + - uses: actions/setup-node@v3 with: node-version: 18 cache: npm - cache-dependency-path: docs/package-lock.json + cache-dependency-path: docs/site/package-lock.json - uses: arduino/setup-task@v1 with: @@ -33,17 +43,12 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} # https://github.com/arduino/setup-task#repo-token - name: Install dependencies - working-directory: docs + working-directory: docs/site run: npm ci - - name: Generate dynamic docs - run: task docs:gen - - name: Build website run: task docs:build - # Popular action to deploy to GitHub Pages: - # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: diff --git a/Taskfile.yml b/Taskfile.yml index ae86fac8..17f00e48 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,17 +2,13 @@ version: "3" includes: docs: - taskfile: ./docs - dir: ./docs + taskfile: ./docs/site + dir: ./docs/site vars: ENTRYPOINT: ./cmd/jalapeno # Path to main package tasks: - docs:gen: - desc: Generate CLI documentation - cmds: - - go run cmd/docs/main.go ./docs/docs/api.md mod: desc: Downloads and tidy Go modules cmds: diff --git a/docs/.gitignore b/docs/.gitignore index b2d6de30..e05adbbb 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,20 +1,9 @@ # Dependencies -/node_modules +node_modules # Production -/build +build # Generated files .docusaurus .cache-loader - -# Misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/docs/pages b/docs/pages new file mode 120000 index 00000000..7048d9af --- /dev/null +++ b/docs/pages @@ -0,0 +1 @@ +site/docs/ \ No newline at end of file diff --git a/docs/README.md b/docs/site/README.md similarity index 100% rename from docs/README.md rename to docs/site/README.md diff --git a/docs/Taskfile.yml b/docs/site/Taskfile.yml similarity index 55% rename from docs/Taskfile.yml rename to docs/site/Taskfile.yml index 36acf44a..7d035f49 100644 --- a/docs/Taskfile.yml +++ b/docs/site/Taskfile.yml @@ -1,29 +1,36 @@ version: "3" +vars: + BUILD_DIR: "../build" + tasks: setup: desc: Setup Docusaurus locally cmds: - npm install + gen: + desc: Generate CLI documentation + dir: "{{.ROOT_DIR}}" + cmds: + - go run cmd/docs/main.go ./docs/pages/api.md + start: desc: Start website + aliases: [run] vars: PORT: '{{default "3001" .PORT}}' + deps: [gen] cmds: - npx docusaurus start --no-open --port={{.PORT}} build: desc: Build website + deps: [gen] cmds: - - npx docusaurus build + - npx docusaurus build --out-dir {{.BUILD_DIR}} clean: desc: Clean temp directories cmds: - - rm -rf ./build - - deploy: - desc: Build and deploy Docusaurus. Requires GIT_USER and GIT_PASS envs to be previous set - cmds: - - npx docusaurus deploy + - rm -rf {{.BUILD_DIR}} diff --git a/docs/babel.config.js b/docs/site/babel.config.js similarity index 100% rename from docs/babel.config.js rename to docs/site/babel.config.js diff --git a/docs/docs/api.md b/docs/site/docs/api.md similarity index 100% rename from docs/docs/api.md rename to docs/site/docs/api.md diff --git a/docs/docs/contributing.md b/docs/site/docs/contributing.md similarity index 100% rename from docs/docs/contributing.md rename to docs/site/docs/contributing.md diff --git a/docs/docs/installation.md b/docs/site/docs/installation.md similarity index 100% rename from docs/docs/installation.md rename to docs/site/docs/installation.md diff --git a/docs/docs/intro.md b/docs/site/docs/intro.md similarity index 100% rename from docs/docs/intro.md rename to docs/site/docs/intro.md diff --git a/docs/docs/usage.md b/docs/site/docs/usage.md similarity index 100% rename from docs/docs/usage.md rename to docs/site/docs/usage.md diff --git a/docs/docusaurus.config.js b/docs/site/docusaurus.config.js similarity index 100% rename from docs/docusaurus.config.js rename to docs/site/docusaurus.config.js diff --git a/docs/package-lock.json b/docs/site/package-lock.json similarity index 100% rename from docs/package-lock.json rename to docs/site/package-lock.json diff --git a/docs/package.json b/docs/site/package.json similarity index 100% rename from docs/package.json rename to docs/site/package.json diff --git a/docs/sidebars.js b/docs/site/sidebars.js similarity index 100% rename from docs/sidebars.js rename to docs/site/sidebars.js diff --git a/docs/src/components/.gitkeep b/docs/site/src/components/.gitkeep similarity index 100% rename from docs/src/components/.gitkeep rename to docs/site/src/components/.gitkeep diff --git a/docs/src/css/custom.css b/docs/site/src/css/custom.css similarity index 100% rename from docs/src/css/custom.css rename to docs/site/src/css/custom.css diff --git a/docs/src/pages/.gitkeep b/docs/site/src/pages/.gitkeep similarity index 100% rename from docs/src/pages/.gitkeep rename to docs/site/src/pages/.gitkeep diff --git a/docs/static/.nojekyll b/docs/site/static/.nojekyll similarity index 100% rename from docs/static/.nojekyll rename to docs/site/static/.nojekyll diff --git a/docs/static/img/logo.png b/docs/site/static/img/logo.png similarity index 100% rename from docs/static/img/logo.png rename to docs/site/static/img/logo.png diff --git a/docs/static/img/logo.svg b/docs/site/static/img/logo.svg similarity index 100% rename from docs/static/img/logo.svg rename to docs/site/static/img/logo.svg