Giter VIP home page Giter VIP logo

actions-hugo's Introduction

Hugo Action

Easy to use action to build your Hugo homepage using the klakegg/hugo Docker images made available.

Getting started

Your workflow is written in e.g. .github/workflows/hugo.yml.

Simple workflow example using the latest and lightest image:

name: Hugo

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: hugo
      uses: klakegg/[email protected]

More advanced workflow example using matrix with multiple versions and image types:

name: Hugo

on: [push]

jobs:
  build:
    strategy:
      matrix:
        version: [0.56.3, 0.57.2]
        image: [busybox, alpine]

    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: hugo
      uses: klakegg/[email protected]
      with:
        version: ${{ matrix.version }}
        image: ${{ matrix.image }}

Configuration

version - Sets the version of Hugo to be used during build. Defaults to blank when not set, resulting in using the very latest version.

image - Sets the image type used. Defaults to busybox when not set. The following are available for most versions (ext indicate extended edition):

  • busybox
  • alpine
  • debian
  • ubuntu
  • ext-alpine
  • ext-debian
  • ext-ubuntu

source - Sets the source directory to be used. Defaults to blank, expecting Hugo config file to be at the root of your repository.

target - Sets the target directory to be used. Defaults to public.

command - Sets the command to be used. Defaults to blank. When set is normal Hugo commands used, however hugo is skipped.

pandoc_command - Sets the Pandoc command used. Defaults to pandoc-default. See use of Pandoc with Hugo for more information.

env - Sets the Hugo environemt. Defaults to DEV. Possible values:

  • DEV
  • production

actions-hugo's People

Contributors

klakegg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

actions-hugo's Issues

How could I use this action?

Say, I wanna deploy my hugo blog to username.github.io, so I need to create a repo username.github.io, and create a .github/workflows/hugo.yml as documented in README? Or do I need to create another repo to host my hugo site, add .github/workflows/hugo.yml, and it automatically publish to username.github.io? Also, I don't see you mention GITHUB_TOKEN while some other actions use.

Use latest extended version?

Is there a way I could set this up to automatically test my site against the latest version of hugo? I need GitInfo, so as I gathered from klakegg/docker-hugo I need to use the extended version, but I would really like to just test against the latest version without needing to manually update the pinned version I am using.

https://github.com/jasikpark/jasik-xyz/blob/master/.github/workflows/hugo.yml

name: Hugo

on:
  schedule:
    # runs daily at 3am
    - cron: '0 3 * * *'
  push:

jobs:
  build:
    strategy:
      matrix:
        image: [busybox, alpine]

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: hugo
      uses: klakegg/[email protected]
      with:
        image: ${{ matrix.image }}

I simply removed the versions option so that it will use the latest version, but it's not clear how to use the latest extended version... I would really appreciate your help!!

Also thanks so much for creating this action -- it was really helpful.

If you update the actions/checkout to v2, here's the correct settings

actions/checkout#149

I tried to use this action with percy-snapshot, and I ended up with .GitInfo.Date returning the wrong info, since checkout@v2 does a shallow clone, which apparently doesn't include the file history.

using

uses: actions/checkout@v2
  with:
    fetch-depth: 0

fixed the problem for me. my new Percy CI config looks like

name: Percy
on:
  push:
    branches:
    - "master"
  pull_request:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Hugo
        uses: klakegg/[email protected]
        with:
          image: latest-ext
      - name: Percy
        uses: percy/[email protected]
        with:
          build-directory: "public"
        env:
          PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

fail with errno: 'ENOENT'

Run klakegg/[email protected]
  with:
    image: ubuntu
    target: public
    pandoc_command: pandoc-default
    env: DEV
  env:
    GOROOT: /__t/go/1.16.6/x64
/usr/bin/docker exec  3aa0fea0245bacdcb7972a672b7345e03b3a77e15f0d605bf5d79d3cf5ca4674 sh -c "cat /etc/*release | grep ^ID"
Using klakegg/hugo:ubuntu
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: spawn docker ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn docker',
  path: 'docker',
  spawnargs: [ 'pull', 'klakegg/hugo:ubuntu' ]
}

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.