/hugo-gh-actions

Primary LanguageShellMIT LicenseMIT

Hugo Github Action

GitHub Action for building and publishing Hugo-built site.

Inspired by khanhicetea/gh-actions-hugo-deploy-gh-pages

This GitHub Action allows you to deploy your Hugo git repo into another one.

Secrets

  • GIT_DEPLOY_KEY - Required your deploy key which has Write access

Create Deploy Key

  1. Generate deploy key ssh-keygen -t rsa -f hugo -q -N ""
  2. Then go to "Settings > Deploy Keys" of repository
  3. Add your public key within "Allow write access" option.
  4. Copy your private deploy key to GIT_DEPLOY_KEY secret in "Settings > Secrets"

Environment Variables

  • HUGO_VERSION : optional, default is 0.54.0 - check all versions here
  • WEBSITE_GIT : required, the website git repo which you want to deploy
  • WEBSITE_DIR : required, the directory which your website git repo will clone into
name: Deploy to GitHub Pages

on:
  push:
    branches:
    - master

jobs:
  hugo-deploy-gh-pages:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: hugo-deploy-gh-pages
      uses: linuxsuren/surenpi@master
      env:
        GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
        HUGO_VERSION: "0.53"
        WEBSITE_GIT: "git@github.com:LinuxSuRen/linuxsuren.github.io.git"
        WEBSITE_DIR: "linuxsuren.github.io"