A GitHub Actions action that automatically builds and deploys your project to GitHub Pages, pushing output to any branch such as gh-pages or docs.
peaceiris/actions-gh-pages
A GitHub Action that deploys static site build output to a GitHub Pages branch from your workflow.
- Stars
- 5,369
- Forks
- 448
- Open issues
- 95
- Last commit
- 20 hours ago
What is it?
This GitHub Action publishes the contents of a build output directory, such as ./public or ./out, to a branch used by GitHub Pages, gh-pages by default. It works with any static site generator that produces plain files, including Hugo, MkDocs, Gatsby, mdBook, Next.js, Nuxt and VuePress, so the deployment step can be added after the build step in an existing workflow.
Authentication can use the automatically created GITHUB_TOKEN for the current repository, an SSH deploy key, or a personal access token. The personal token or deploy key is needed to publish into another repository through the external_repository option. Other options cover the target branch, a destination subdirectory, excluding files, adding a CNAME file, controlling Jekyll processing, keeping existing files, force-orphan branches, commit author and message, and creating Git tags.
The action runs on Linux, macOS and Windows runners, and supports GitHub Enterprise Server from version 2.22.6.
Key features
- 01Deploys any static build output directory to a GitHub Pages branch.
- 02Supports GITHUB_TOKEN, SSH deploy keys and personal access tokens.
- 03Can publish to a separate external repository.
- 04Options for CNAME files, Jekyll bypass and excluding files from deployment.
- 05Can keep existing files or create a single-commit orphan branch.
- 06Runs on Linux, macOS and Windows runners.
Use cases
- Publishing a Hugo or MkDocs documentation site automatically on every push to main.
- Deploying a Next.js or Nuxt static export to GitHub Pages from CI.
- Publishing a public site from a private source repository using a personal access token.
- Scheduling regular rebuilds and deployments of a generated site.
Quick start
- 1
Add the workflow file .github/workflows/gh-pages.yml and push it to the default branch
- 2
Use the deploy step to publish your build output directory
uses: peaceiris/actions-gh-pages@v4
Things to know
- Requires the repository's Pages settings to be configured before the first deployment with GITHUB_TOKEN.
- Deploy keys are needed for Windows runners, since the deploy_key option does not work there.
In collections
Topics
FAQ
- What is actions-gh-pages?
- A GitHub Action that deploys static site build output to a GitHub Pages branch from your workflow. This GitHub Action publishes the contents of a build output directory, such as ./public or ./out, to a branch used by GitHub Pages, gh-pages by default. It works with any static site generator that produces plain files, including Hugo, MkDocs, Gatsby, mdBook, Next.js, Nuxt and VuePress, so the deployment step can be added after the build step in an existing workflow.
- Is actions-gh-pages free to use? What license does it have?
- actions-gh-pages is open source under the MIT license. Check the license terms before using it in commercial products.
- Is actions-gh-pages still maintained?
- Actively maintained. The last commit to actions-gh-pages was on Nov 6, 2026.
- What can I use actions-gh-pages for?
- Publishing a Hugo or MkDocs documentation site automatically on every push to main. Deploying a Next.js or Nuxt static export to GitHub Pages from CI. Publishing a public site from a private source repository using a personal access token. Scheduling regular rebuilds and deployments of a generated site.
- How do I install actions-gh-pages?
- Add the workflow file .github/workflows/gh-pages.yml and push it to the default branch Use the deploy step to publish your build output directory: uses: peaceiris/actions-gh-pages@v4
- Where can I get actions-gh-pages?
- The source code and installation instructions are on GitHub: https://github.com/peaceiris/actions-gh-pages
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A CI/CD security agent for GitHub Actions runners that monitors network egress, file writes and process activity to detect supply chain attacks.
A GitHub Action that runs commands on remote servers over SSH from your CI/CD workflows.
Open-source Hugo framework of Tailwind blocks for building landing pages, portfolios, blogs and docs from plain Markdown files.
A one-click WordPress plugin that exports posts, pages, metadata and settings to Markdown and YAML for Jekyll, Hugo or other static site generators.
GitHub CLI extension that lets you write AI-powered repository automation as Markdown and runs it securely through GitHub Actions.