Skip to content

Commit

Permalink
Split documentation pages and site
Browse files Browse the repository at this point in the history
  • Loading branch information
majori committed Sep 21, 2023
1 parent 6e0d0c3 commit 774e0e0
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 33 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,34 @@ 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:
version: 3.x
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:
Expand Down
8 changes: 2 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 2 additions & 13 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -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*
1 change: 1 addition & 0 deletions docs/pages
File renamed without changes.
21 changes: 14 additions & 7 deletions docs/Taskfile.yml → docs/site/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -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}}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes

0 comments on commit 774e0e0

Please sign in to comment.