Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

github-pages-deploy-action

> DevOps
Open source

Automatically deploy your project to GitHub Pages using GitHub Actions. This action can be configured to push your production-ready code into any branch you'

4.6K stars0 likes1 views
WebsiteGitHub

About

Automatically deploy your project to GitHub Pages using GitHub Actions. This action can be configured to push your production-ready code into any branch you'

GitHub Pages Deploy Action :rocket:

Automatically deploy your project to GitHub Pages with GitHub Actions. This action can be configured to push your production-ready code into any branch you'd like, including gh-pages and docs. It can also handle cross repository deployments and works with GitHub Enterprise too.

Maintenance of this project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here.

          

                                              

Getting Started :airplane:

You can include the action in your workflow to trigger on any event that GitHub actions supports. If the remote branch that you wish to deploy to doesn't already exist the action will create it for you. Your workflow will also need to include the actions/checkout step before this workflow runs in order for the deployment to work. If you intend to make multiple deployments in quick succession you may need to leverage the concurrency parameter in your workflow to prevent overlaps.

You can view an example of this below.

…

[!NOTE] You must configure your repository to deploy from the branch you push to. To do this, go to your repository settings, click on Pages, and choose Deploy from a Branch from the Source dropdown. From there select the branch you supplied to the action. In most cases this will be gh-pages as that's the default.

If you'd like to make it so the workflow only triggers on push events to specific branches then you can modify the on section.

yaml
on:
  push:
    branches:
      - main

[!WARNING] If you do not supply the action with an access token or an SSH key, you must access your repositories settings and provide Read and Write Permissions to the provided GITHUB_TOKEN, otherwise you'll potentially run into permission issues. Alternatively you can set the following in your workflow file to grant the action the permissions it needs.

yaml
permissions:
  contents: write

Configuration

The with portion of the workflow must be configured before the action will work. You can add these in the with section found in the examples above. Any secrets must be referenced using the bracket syntax and stored in the GitHub repository's Settings/Secrets menu. You can learn more about setting environment variables with GitHub actions here.

Required Setup

The following options must be configured in order to make a deployment.

Key Value Information Type Required
folder The folder in your repository that you want to deploy. If your build script compiles into a directory named build you'd put it here. If you wish to deploy the root directory you can place a . here. You can also utilize absolute file paths by prepending ~ to your folder path. Note that any files/folders matching .gitignore entries will not be deployed. Some tools auto-generate a .gitignore file for build output. with Yes

By default, the action does not need any token configuration and uses the provided repository scoped GitHub token to make the deployment. If you require more customization you can modify the deployment type using the following options.

Key Value Information Type Required
token This option defaults to the repository scoped GitHub Token. However, if you need more permissions for things such as deploying to another repository, you can add a Personal Access Token (PAT) here. This should be stored in the secrets / with menu as a secret. We recommend using a service account with the least permissions necessary and recommend when generating a new PAT that you select the least permission scopes necessary. Learn more about creating and using encrypted secrets here. with No
ssh-key You can configure the action to deploy using SSH by setting this option to a private SSH key stored as a secret. It can also be set to true to use an existing SSH client configuration. For more detailed information on how to add your public/private ssh key pair please refer to the Using a Deploy Key section of this README. with No

Optional Choices

Key Value Information Type Required
branch This is the branch you wish to deploy to, for example, gh-pages or docs. Defaults to gh-pages. with No
git-config-name Allows you to customize the name that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the name in the GitHub context, followed by the name of the action. with No
git-config-email Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. You can include <> for the value if you wish to omit this field al

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptactionactionscicdcontinuous-delivery

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理