---
title: "Monorepo package and documentation site"
description: "This pnpm workspace contains a private packages/core, a publishable packages/widget and an independent apps/docs. Copy the full directory, including its root lockfile and mise.toml. Replace the package name, repository and tag prefix, and replace XOVA_ACTIONS_SHA with the full SHA of a commit that passed CI in xova-dev/actions."
canonical_url: "https://actions.xovajs.com/en/examples/monorepo"
---
# Monorepo package and documentation site

> This pnpm workspace contains a private packages/core, a publishable packages/widget and an independent apps/docs. Copy the full directory, including its root lockfile and mise.toml. Replace the package name, repository and tag prefix, and replace XOVA_ACTIONS_SHA with the full SHA of a commit that passed CI in xova-dev/actions.

This pnpm workspace contains a private `packages/core`, a publishable `packages/widget` and an independent `apps/docs`. Copy the full directory, including its root lockfile and `mise.toml`. Replace the package name, repository and tag prefix, and replace `XOVA_ACTIONS_SHA` with the full SHA of a commit that passed CI in `xova-dev/actions`.

[Complete project](https://github.com/xova-dev/actions/tree/main/examples/monorepo)

## Project configuration

Install from the widget directory using the root lockfile and check the whole workspace. The widget bundles core, then installs and imports the packed tarball outside the workspace. The site builds separately in apps/docs.

```json [.github/xova.json]
{
  "schemaVersion": 1,
  "setup": {
    "toolchain": "mise",
    "working-directory": "packages/widget",
    "install-command": "pnpm install --frozen-lockfile",
    "cache": {
      "pnpm": "pnpm-lock.yaml"
    }
  },
  "code": {
    "check-command": "pnpm -w test"
  },
  "npm": {
    "tag-prefix": "widget@",
    "package-manager": "pnpm",
    "verify-command": "pnpm build",
    "tarball-verify-command": "pnpm test:pack"
  },
  "artifact": {
    "provider": "github-pages",
    "working-directory": "apps/docs",
    "check-command": "pnpm test",
    "build-command": "pnpm build",
    "output-directory": "_site",
    "deployment-policy": "always",
    "environment": "github-pages",
    "concurrency-group": "github-pages"
  }
}
```

## Daily CI

Pull requests and pushes to main build a downloadable site after checks pass. To deploy main pushes to GitHub Pages, set the repository variable `DOCS_CHANNEL` to `main` and select GitHub Actions in Pages settings.

```yaml [.github/workflows/ci.yml]
name: CI
on:
  pull_request:
  push:
    branches: [main]
permissions:
  contents: read
jobs:
  check:
    uses: xova-dev/actions/.github/workflows/check.yml@XOVA_ACTIONS_SHA
  build_site:
    needs: check
    uses: xova-dev/actions/.github/workflows/check.yml@XOVA_ACTIONS_SHA
    with:
      task: artifact
      source-sha: ${{ needs.check.outputs.source-sha }}
  deploy:
    if: github.event_name == 'push' && vars.DOCS_CHANNEL == 'main'
    needs: build_site
    uses: xova-dev/actions/.github/workflows/deploy.yml@XOVA_ACTIONS_SHA
    permissions:
      contents: read
      pages: write
      id-token: write
    with:
      source-sha: ${{ needs.build_site.outputs.source-sha }}
      artifact-id: ${{ needs.build_site.outputs.artifact-id }}
```

## Tag publication

A tag such as `widget@1.2.0` reuses or runs CI at the tag commit, publishes the widget to npm and creates a GitHub Release from the package changelog. By default the site builds alongside publication and deploys after a stable Release. With `deployment-policy: always`, rerunning deployment for an older stable tag can put that version back on Pages. Setting `DOCS_CHANNEL=main` skips the site build and deployment on tags.

```yaml [.github/workflows/publish.yml]
name: Publish widget
on:
  push:
    tags: ['widget@*']
permissions:
  contents: read
jobs:
  verify:
    uses: xova-dev/actions/.github/workflows/check-ci.yml@XOVA_ACTIONS_SHA
    permissions:
      contents: read
      actions: read
    with:
      run-check-on-miss: true
  publish:
    needs: verify
    uses: xova-dev/actions/.github/workflows/publish.yml@XOVA_ACTIONS_SHA
    permissions:
      contents: write
      id-token: write
    with:
      expected-sha: ${{ needs.verify.outputs.source-sha }}
  build_site:
    if: vars.DOCS_CHANNEL != 'main'
    needs: verify
    uses: xova-dev/actions/.github/workflows/check.yml@XOVA_ACTIONS_SHA
    with:
      task: artifact
      source-sha: ${{ needs.verify.outputs.source-sha }}
  deploy:
    needs: [build_site, publish]
    uses: xova-dev/actions/.github/workflows/deploy.yml@XOVA_ACTIONS_SHA
    permissions:
      contents: read
      pages: write
      id-token: write
    with:
      source-sha: ${{ needs.build_site.outputs.source-sha }}
      artifact-id: ${{ needs.build_site.outputs.artifact-id }}
      release-tag: ${{ github.ref_name }}
```

See the [release guide](https://actions.xovajs.com/en/guides/releasing) to prepare the tag.


## Sitemap

See the full [sitemap](https://actions.xovajs.com/sitemap.md) for all pages.
