Deploy docs #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy docs | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Publish as version[?]:' | |
default: 'latest' | |
permissions: | |
contents: write | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
- name: Setup node and restore cached dependencies | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: Install packages | |
run: pnpm install --frozen-lockfile | |
- name: Build specific version | |
run: pnpm docs:build --base /${{ github.event.inputs.version }}/ | |
if: ${{ github.event.inputs.version != 'latest' }} | |
- name: Deploy to specific version | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: ${{ github.event.inputs.version != 'latest' }} | |
with: | |
folder: ./docs/.vitepress/dist | |
branch: gh-pages | |
# Specific folder for this version | |
target-folder: ${{ github.event.inputs.version }} | |
clean: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'Deploy docs for ${{ github.event.inputs.version }}' | |
- name: Build latest | |
run: pnpm docs:build | |
if: ${{ github.event.inputs.version == 'latest' }} | |
- name: Deploy to latest | |
if: ${{ github.event.inputs.version == 'latest' }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ./docs/.vitepress/dist | |
clean: true | |
clean-exclude: v* | |
branch: gh-pages | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'Deploy docs for latest' |