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. 💖
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.
name: Build and Deploy
on: [push]
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v6
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
npm ci
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build # The folder the action should deploy.
[!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 chooseDeploy from a Branchfrom theSourcedropdown. From there select the branch you supplied to the action. In most cases this will begh-pagesas 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.
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 Permissionsto the providedGITHUB_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.
permissions:
contents: write
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.
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 |
| 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 deploym |
$ claude mcp add github-pages-deploy-action \
-- python -m otcore.mcp_server <graph>