Giter VIP home page Giter VIP logo

hugo-deploy-gh-pages's Introduction

GitHub Action to build and deploy a Hugo site to GitHub Pages

This GitHub action will build your Hugo site, and then publish back to GitHub Pages.

Secrets

  • TOKEN: A GitHub access token that can push to other repos, which in this case will be your GitHub pages repo. We cannot use GITHUB_TOKEN as defined here because it is a locally scoped token to a specific repo.

Environment Variables

  • GITHUB_ACTOR: The name of the person or app that initiated the workflow. For example, octocat. See here.
  • TARGET_REPO: This is the repo slug for the GitHub pages site. e.g. benmatselby/benmatselby.github.io.
  • HUGO_VERSION: This allows you to control which version of Hugo you want to use. There is a default within the action, but this may be out of date.

Example

name: Push to GitHub Pages on push to master
on:
  push:
    branches:
      - master

jobs:
  build:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout master
        uses: actions/checkout@v1

      - name: Deploy the site
        uses: benmatselby/hugo-deploy-gh-pages@master
        env:
          HUGO_VERSION: 0.57.2
          TARGET_REPO: benmatselby/benmatselby.github.io
          TOKEN: ${{ secrets.TOKEN }}

This will:

  • Clone the TARGET_REPO into the build folder.
  • Commit the changes with the date as the git commit message.
  • Push back to GitHub.

Testing

To test this action locally, you can run the following in your hugo site:

TARGET_REPO=benmatselby/benmatselby.github.io ../hugo-deploy-gh-pages/action.sh

hugo-deploy-gh-pages's People

Contributors

benmatselby avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.