remirror/remirror

View on GitHub
.github/workflows/docs.yml

Summary

Maintainability
Test Coverage
name: docs

on:
  push:
    branches:
      - v1
      - main
  pull_request:
    types: [opened, synchronize]
    branches:
      - v1
      - main

env:
  PNPM_CACHE_FOLDER: .pnpm-store

jobs:
  deploy_docs:
    timeout-minutes: 90
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/v1' || github.ref == 'refs/heads/main' || github.event.pull_request

    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: setup caching
        uses: actions/cache@v3
        with:
          path: ${{ env.PNPM_CACHE_FOLDER }}
          key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

      - name: setup node.js
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: install and audit
        uses: ./support/actions/pnpm
        with:
          cache: ${{ env.PNPM_CACHE_FOLDER }}

      - name: generate .d.ts files
        run: pnpm typecheck

      - name: generate api markdown files
        run: pnpm api

      - name: build docs
        run: |
          export NODE_OPTIONS=--max_old_space_size=4096
          pnpm build:docs

      - name: deploy docs
        uses: nwtgck/actions-netlify@develop
        with:
          publish-dir: './website/build'
          production-branch: v1
          github-token: ${{ secrets.GITHUB_TOKEN }}
          deploy-message: 'Deploy Docs from GitHub Actions - ${{ github.event.pull_request.title || github.ref }}'
          alias: ${{ github.head_ref }}
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NEXT_NETLIFY_SITE_ID }}