Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 1.76 KB

File metadata and controls

79 lines (57 loc) · 1.76 KB

@nx-extend/github-pages

@nx-extend/github-pages NPM package

Nx plugin to deploy your app to GitHub Pages.

Features

  • Deploy static sites to GitHub Pages
  • Automatic deployment from build output
  • Configurable target branch
  • Integration with GitHub Actions

Setup

Prerequisites

  • GitHub repository with Pages enabled
  • GH_PAGES_ACCESS_TOKEN environment variable set with a GitHub Personal Access Token
  • A build target configured in your project

Install

npm install -D @nx-extend/github-pages

Usage

Configure Deploy Target

Add the deploy target to your project.json:

{
  "targets": {
    "build": {
      "executor": "@nx/web:webpack",
      "options": {
        "outputPath": "dist/apps/my-app"
      }
    },
    "deploy": {
      "executor": "@nx-extend/github-pages:deploy",
      "options": {
        "branch": "gh-pages"
      }
    }
  }
}

Deploy

nx deploy my-app

Environment Variables

Set the following environment variable before deploying:

export GH_PAGES_ACCESS_TOKEN="your-github-token"

Available Options

Name Type Default Description
branch string "gh-pages" The branch to deploy to (typically gh-pages)

Notes

  • The executor automatically reads the outputPath from your build target configuration
  • Make sure your build target runs before deploying
  • The GitHub token needs repository write permissions