Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Hugo to GH Pages

v1

Hugo to GH Pages

upload-cloud

Hugo to GH Pages

GitHub Action for Building a Hugo Site and Pushing it to Github Pages

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Hugo to GH Pages

uses: chabad360/hugo-gh-pages@v1

Learn more about this action in chabad360/hugo-gh-pages

Choose a version

Image Credit: Peaceiris

Image Credit: Peaceiris

Build and Publish your Hugo Site to Github Pages

 

This Action builds your Hugo Site (using the latest Hugo Extended) and pushes it to Github Pages.

This action also contains support for several Hugo Helpers:

Name Support
reStructuredText ️ ✔
Pandoc
Asciidoctor
PostCSS
Pygments

If your site requires the use of another externel helper, submit an issue and I'll try to add it.

Getting started

This is a basic Yaml workflow to get you started (for more information scroll down to Inputs):

name: Publish Site

on:
  push:
    branches:
      - master

jobs:
  build-deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
        with:
          submodules: true

      - name: Publish Site
        uses: chabad360/hugo-gh-pages@master
        with:
          githubToken: ${{ secrets.PERSONAL_TOKEN }}

To add to an already exsiting workflow, this is the section that matters:

- name: Publish Site
  uses: chabad360/hugo-gh-pages@master
  with:
    githubToken: ${{ secrets.PERSONAL_TOKEN }}

Inputs

Key Description Required Default
githubToken A Github Personal Access Token with repo permissions. N/A
cname The custom domain name for your GH Pages Site. N/A
branch The branch to push the built site to. gh-pages

Example

- name: Publish Site
  uses: chabad360/hugo-gh-pages@master
  with:
    githubToken: ${{ secrets.PERSONAL_TOKEN }}
    # Remember to set this as a secret (i.e. secrets.PERSONAL_TOKEN).
    # Don't forget to set the secret value in the project settings.
    cname: mysite.com # Or anything else
    # Only use if you have a custom domain for your site.
    branch: master # Or anything else
    # Only use if your site is not hosted on the gh-pages branch.

Credit

This project is forked from mattbailey/actions-hugo