Home

Awesome

Analog Publish GitHub Pages

CI Check dist/ CodeQL Coverage

Build a static AnalogJS site and deploy it on GitHub Pages.

Versions and Compatibility

Tested with Node 20, Angular ^17.0.0 and AnalogJS 1.0.0-beta.1.

Usage

name: Build and Deploy

on:
  push:
    branches:
      - 'main'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20.x'
      - uses: k9n-dev/analog-publish-gh-pages@v1.0.0
        with:
          # Required: token to access / deploy on GitHub Pages
          access-token: ${{ secrets.ACCESS_TOKEN }}
          # Optional: arguments passed to `npm ci`
          install-args: '--legacy-peer-deps'
          # Optional: arguments passed to `npm run build`
          build-args: ''
          # Optional: the directory after build process to deploy (defaults to `dist/analog/public`)
          deploy-dir: 'dist/analog/public'
          # Optional: a specific branch where the static site should be deployed (defaults to `gh-pages`)
          deploy-branch: 'gh-pages' # important: --dry-run (see option below) won't actually deploy the site!
          # Optional: prevent an actual deployment (e. g. for running in branch pipelines)
          dry-run: true

Options (with)

To deploy, you need to provide a personal access-token. This token must be configured as a Repository Secret.

<!-- START: table generated from actions.yml -->
inputrequireddefaultdescription
package-managerfalsenpmThe package manager to be used (npm, yarn, pnpm).
access-tokentrue-A personal access token needed to deploy your site after it has been built.
install-argsfalse-Additional arguments that get passed to the install command of the used package manager (e. g. --legacy-peer-deps).
build-argsfalse-Additional arguments that get passed to build script of your package.json file.
deploy-dirfalsedist/analog/publicThe path to the directory to deploy.
deploy-branchfalsegh-pagesThe branch where the static site should be deployed.
dry-runfalsefalseDon't actually deploy if truthy.
<!-- END: table generated from actions.yml -->

Assumptions

Build command

The build script of your package.json is executed by this action. Additional arguments can be passed by setting build-args.

CNAME file

You have a custom domain you would like to use? Fancy! 😎 This Action's got you covered! Assuming you have already set up your DNS provider as defined in the GitHub Pages docs, all we need next is a CNAME file at the root of your project with the domain you would like to use. For example:

example.com

.nojekyll file

AnalogJS creates files starting with an underscore (_) during the build process. By default GitHub Pages assumes a Jekyll project is being published. This assumption comes with the fact, all files starting with _ are being ignored. To fix this, the actions adds a .nojekyll file to the destination directory and places it in the root on the gh-pages branch.