ci: improve docs workflow by uploading GitHub Pages artifact and rest… #24
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Docs | |
on: [push] | |
jobs: | |
build: | |
# Specify runner + build & upload the static files as an artifact | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@v4 # Extracts pnpm version from package.json packageManager field | |
- name: Use Node ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'pnpm' | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Generate docs | |
run: pnpm typedoc | |
- name: Upload static files as artifact | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action | |
with: | |
path: docs # Build output folder | |
deploy: | |
# Add a dependency to the build job | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action |