Skip to content

Latest commit

 

History

History
77 lines (44 loc) · 3.41 KB

File metadata and controls

77 lines (44 loc) · 3.41 KB

publish-github-pages

Publishes a directory as the GitHub Pages website for the current repository.

Example

steps:
  - uses: actions/checkout@v4

  - uses: giancosta86/aurora-github/actions/publish-github-pages@v7

Please, note: this action is automatically run by publish-npm-package, publish-rust-crate and publish-rust-wasm.

How it works

  1. If source-directory is set to an empty string (the default) or refers to a missing directory, if optional is set to true the action will simply exit, otherwise the workflow will fail.

  2. If source-directory contains a package.json file:

    1. Run enforce-branch-version, forwarding the enforce-branch-version input to its mode input.

    2. Set up a NodeJS environment via setup-nodejs-context in source-directory.

    3. Run pnpm build.

    4. The dist subdirectory will contain the actual website.

  3. If dry-run is set to true, interrupt the process without failing.

  4. Publish the files to GitHub Pages.

Requirements

  • The following permissions must be set for the action to work:

    • pages: write

    • id-token: write

    Please, note: at the same time, you may want to declare your required default permissions - such as contents, necessary for some Git operations - because, otherwise, they would be disabled by an explicit permissions block.

  • GitHub Pages must be enabled for the current repository - and having GitHub Actions as their source.

  • It is recommended that GitHub Actions have read/write permissions on the repository.

  • Please, refer to setup-nodejs-context for details about setting up a NodeJS environment.

Inputs 📥

Name Type Description Default value
source-directory string Directory containing the website .
optional boolean Whether source-directory can be empty string or missing directory false
enforce-branch-version inject,check,skip How the branch version should be enforced inject
dry-run boolean Stop the publication just before uploading false

Outputs 📤

Name Type Description Example
url string The URL of the published website HTTPS url

Further references