Skip to content

Commit

Permalink
ci: migrate docs to GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
gruhn committed Feb 27, 2024
1 parent 127a573 commit d01f49e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: release npm package

on:
push:
Expand All @@ -24,12 +24,13 @@ jobs:
run: |
pnpm install
pnpm run build
# pnpm run docs:build
# - name: Deploy Docs
# uses: JamesIves/[email protected]
# with:
# branch: gh-pages
# folder: docs/.vitepress/dist
pnpm run docs:build
- name: Deploy Docs
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs/.vitepress/dist
clean-exclude: pr-preview
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# https://github.com/rossjrw/pr-preview-action
name: deploy docs

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- run: corepack enable

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 18
cache: pnpm

- name: Install & Build
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed
env:
VITEPRESS_BASE: test
run: |
pnpm install
pnpm run build
pnpm run docs:build
- name: Deploy
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/.vitepress/dist/
2 changes: 1 addition & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default withPwa(
},
pwa: {
mode: 'development',
base: '/',
base: `/${process.env.VITEPRESS_BASE ?? ''}`,
scope: '/',
registerType: 'autoUpdate',
// injectRegister: 'inline',
Expand Down

0 comments on commit d01f49e

Please sign in to comment.