Commit a470d2a5 authored by Valentin Guyon's avatar Valentin Guyon Committed by Thomas Boni
Browse files

feat (hugo): new job

parent f37e2363
Loading
Loading
Loading
Loading

jobs/hugo/README.md

0 → 100644
+32 −0
Original line number Diff line number Diff line
## Objective

[Hugo](https://gohugo.io/){:target="_blank"} is a static HTML and CSS website generator written in Go. It is optimized for speed, ease of use, and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website.

## How to use it

1. Ensure that your project have been initialised with the `hugo new site website` command. Please, check the [documentation](https://gohugo.io/documentation/){:target="_blank"} to learn more about Hugo.
1. Add this job URL inside the `include` list of your `.gitlab-ci.yml` file (see the [quick setup](/use-the-hub/#quick-setup)). You can specify [a fixed version](#changelog) instead of `latest`.
    ```yaml
      - remote: 'https://jobs.r2devops.io/latest/hugo.yml'
    ```
1. If you need to customize the job (stage, variables, ...) 👉 check the [jobs
   customization](/use-the-hub/#jobs-customization)
1. Well done, your job is ready to work ! 😀

## Job details

* Job name: `hugo`
* Docker image:
[`golang:1.17.6-buster`](https://hub.docker.com/r/_/golang){:target="_blank"}
* Default stage: `build`
* When: `always`

### Variables

| Name | Description | Default |
| ---- | ----------- | ------- |
| `PROJECT_ROOT` <img width=100/> | Relative to root of your repository, it is the path to your project. <img width=175/>| `.` <img width=100/>|
| `HUGO_VERSION` <img width=100/> | The Hugo version to install and execute. <img width=175/>| `0.92.0` <img width=100/>|
| `HUGO_SOURCE` <img width=100/> | Directory name of the source files to build the Hugo website. <img width=175/>| `website` <img width=100/>|
| `HUGO_OUTPUT` <img width=100/> | Directory name of the Hugo output. <img width=175/>| `public/` <img width=100/>|
| `ADDITIONAL_OPTIONS` <img width=100/> | Possibility to add more options into the Hugo command. <img width=175/>| ` ` <img width=100/>|

jobs/hugo/hugo.yml

0 → 100644
+31 −0
Original line number Diff line number Diff line
# Job from R2Devops hub --> r2devops.io

stages:
  - build

hugo:

  image:
    name: golang:1.17.6-buster
    entrypoint: [""]

  stage: build

  variables:
    PROJECT_ROOT: "."
    HUGO_VERSION: "0.92.0"
    HUGO_SOURCE: "website"
    HUGO_OUTPUT: "public/"
    ADDITIONAL_OPTIONS: ""

  script:
    - cd ${PROJECT_ROOT}
    - curl -SL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz -o /tmp/hugo.tar.gz
    - tar -xzf /tmp/hugo.tar.gz -C /tmp
    - mv /tmp/hugo /usr/local/bin/
    - hugo -s ${HUGO_SOURCE} -d ${CI_PROJECT_DIR}/${HUGO_OUTPUT} ${ADDITIONAL_OPTIONS}

  artifacts:
    when: always
    paths:
      - ${CI_PROJECT_DIR}/${HUGO_OUTPUT}

jobs/hugo/job.yml

0 → 100644
+13 −0
Original line number Diff line number Diff line
name: hugo
description: Hugo is a static HTML and CSS website generator written in Go. It is optimized for speed, ease of use, and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website.
default_stage: build
icon: 📃
maintainer: valentin.guyon.vg
license: Apache-2.0
images:
  "golang": "1.17.6-buster"
tools:
labels:
  - GitLab
  - Documentation
  - Build
+0 −0

Empty file added.

+1 −0
Original line number Diff line number Diff line
* Initial version
 No newline at end of file