peaceiris/actions-gh-pages@v4

GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.

At a glance

Latest major
v4
Repository
peaceiris/actions-gh-pages
Inputs
20 (0 required)
Outputs
0
Runs using
node24
License
MIT
Last checked

Inputs and outputs come straight from the action's official action.yml. See our editorial standards.

Usage

- uses: peaceiris/actions-gh-pages@v4

Inputs

NameRequiredDefaultDescription
deploy_keyNononeSet a SSH private key from repository secret value for pushing to the remote branch.
github_tokenNononeSet a generated GITHUB_TOKEN for pushing to the remote branch.
personal_tokenNononeSet a personal access token for pushing to the remote branch.
publish_branchNogh-pagesSet a target branch for deployment.
publish_dirNopublicSet an input directory for deployment.
destination_dirNononeSet an destination subdirectory for deployment.
external_repositoryNononeSet an external repository (owner/repo).
allow_empty_commitNofalseIf empty commits should be made to the publication branch
keep_filesNofalseIf existing files in the publish branch should be not removed before deploying
force_orphanNofalseKeep only the latest commit on a GitHub Pages branch
user_nameNononeSet Git user.name
user_emailNononeSet Git user.email
commit_messageNononeSet a custom commit message with a triggered commit hash
full_commit_messageNononeSet a custom full commit message without a triggered commit hash
tag_nameNononeSet tag name
tag_messageNononeSet tag message
enable_jekyllNofalseEnable the GitHub Pages built-in Jekyll
disable_nojekyllNofalseAn alias for enable_jekyll to disable adding .nojekyll file to a publishing branch
cnameNononeSet custom domain
exclude_assetsNo.githubSet files or directories to exclude from a publish directory.

Outputs

This action declares no outputs in its action.yml.

Examples

Publish a folder to GitHub Pages

Push built files to the gh-pages branch with the built-in token.

name: Example
on:
  push:
    branches: [main]

permissions:
  contents: write

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - name: Build
        run: mkdir -p dist && echo hi > dist/index.html
      - name: GitHub Pages action
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist

Each example passed actionlint (syntax, expressions and the inputs it knows for this action). They were not run in a live repository, so replace placeholder values such as names, ARNs and paths with your own.

Something out of date or wrong? Report it on our Contact page. This page is rebuilt from the action's repository roughly once a week.