Skip to content
πŸ“¦πŸ’» A GitHub Action that pushes a directory to the gh-pages branch
Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Dockerfile
LICENSE
README.md
entrypoint

README.md

Push to GitHub Pages

A GitHub Action that pushes a directory to the gh-pages branch.

Usage

This action pushes a directory of your project to the gh-pages branch, effectively deploying your site to GitHub Pages.

One example workflow is to automatically build and deploy your site whenever changes are made to the master branch:

workflow "Deploy to GitHub Pages" {
  on = "push"
  resolves = [ "Deploy" ]
}

action "Default Branch" {
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Install dependencies" {
  needs = [ "Default Branch" ]
  uses = "actions/npm@master"
  args = "install"
}

action "Build" {
  needs = [ "Install dependencies" ]
  uses = "actions/npm@master"
  args = "run build"
}

action "Deploy" {
  needs = [ "Build" ]
  uses = "JasonEtco/upload-to-gh-pages@master"
  secrets = ["GITHUB_TOKEN"]
  args = "public"
}

Requirements

You must pass at least one argument, the path to the directory you want to push. This is usually the output folder of a static site generator. If you want it to be the current directory, just pass .. You must also include the GITHUB_TOKEN secret, otherwise the Action won't be able to push to the branch.

action "Deploy" {
  uses = "JasonEtco/push-to-gh-pages@master"
  args = "_site"
  secrets = ["GITHUB_TOKEN"]
}
You can’t perform that action at this time.