Skip to content

Commit

Permalink
feat(workflows): add new workflow for documentation with pnpm
Browse files Browse the repository at this point in the history
Added a new workflow for documentation generation using pnpm package manager. This workflow includes building and deploying documentation artifacts.
  • Loading branch information
liblaf committed Mar 18, 2024
1 parent d7bce7e commit 2415785
Show file tree
Hide file tree
Showing 7 changed files with 9,350 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
contents: write
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: data-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/docs-bun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Docs

on:
push:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
data:
name: Data
permissions:
contents: write
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/data.yaml

build:
name: Build
permissions:
contents: write
needs:
- data
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install Dependencies
run: bun install --verbose
working-directory: docs
- name: Download Data
uses: actions/checkout@v4
with:
ref: data
path: docs/data
- name: Build
run: bun run build
working-directory: docs
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/build

deploy:
name: Deploy
permissions:
contents: write
needs:
- build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: docs
path: docs/build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build
single-commit: true
17 changes: 13 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,33 @@ jobs:
contents: write
needs:
- data
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
package_json_file: docs/package.json
- uses: actions/setup-node@v4
with:
node-version: latest
cache: pnpm
cache-dependency-path: docs/pnpm-lock.yaml
- name: Install Dependencies
run: bun install --verbose
run: pnpm install
working-directory: docs
- name: Download Data
uses: actions/checkout@v4
with:
ref: data
path: docs/data
- name: Build
run: bun run build
run: pnpm run build
working-directory: docs
- name: Upload Artifacts
uses: actions/upload-artifact@v4
Expand Down
Binary file modified docs/bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const config: Config = {
{
indexBlog: false,
docsRouteBasePath: "/",
language: ["en", "zh"],
hashed: true,
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
Expand Down
Loading

0 comments on commit 2415785

Please sign in to comment.