Giter Club home page Giter Club logo

gh-actions-hugo-deploy-gh-pages's Introduction

Hugo Github Action

GitHub Action for building and publishing Hugo-built site.

Inspired by BryanSchuetz/jekyll-deploy-gh-pages

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

  • GITHUB_BRANCH : optional, default is gh-pages

  • GITHUB_REMOTE_REPOSITORY : optional, default is GITHUB_REPOSITORY

Example

push.yml (New syntax)

Deploy to gh-pages branch: (under same repo)

  • Note: put the CNAME file within your domain name inside static folder of compiling branch (master)
name: Deploy to GitHub Pages

on: push

jobs:
  hugo-deploy-gh-pages:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: hugo-deploy-gh-pages
      uses: khanhicetea/gh-actions-hugo-deploy-gh-pages@master
      env:
        GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
        HUGO_VERSION: "0.53"

Deploy to Remote Branch:

name: Deploy to Remote Branch

on:
  push:
    branches:
      - master
      
jobs:
  hugo-deploy-gh-pages:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: hugo-deploy-gh-pages
      uses: khanhicetea/gh-actions-hugo-deploy-gh-pages@master
      env:
        GITHUB_REMOTE_REPOSITORY: <username>/<remote_repository_name>
        GITHUB_BRANCH: <custom_branch>
        GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
        HUGO_VERSION: "0.58.3"

Note: make sure to add GIT_DEPLOY_KEY in secrets of mentioned GITHUB_REMOTE_REPOSITORY

main.workflow (Old syntax - deprecated)

workflow "Deploy to GitHub Pages" {
  on = "push"
  resolves = ["hugo-deploy-gh-pages"]
}

action "hugo-deploy-gh-pages" {
  uses = "khanhicetea/gh-actions-hugo-deploy-gh-pages@master"
  secrets = [
    "GIT_DEPLOY_KEY"
  ]
  env = {
    HUGO_VERSION = "0.53"
    GITHUB_BRANCH = "master"
  }
}

Other actions

LICENSE

Copyright (c) 2019

Licensed under the MIT License.

gh-actions-hugo-deploy-gh-pages's People

Contributors

codenio avatar gerrywastaken avatar khanhicetea avatar moreal 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.