GithubHelp home page GithubHelp logo

drone-plugins / drone-hugo Goto Github PK

View Code? Open in Web Editor NEW
29.0 10.0 20.0 98 KB

Drone plugin to publish Hugo generated websites

Home Page: https://plugins.drone.io/plugins/hugo

License: Apache License 2.0

Go 100.00%
drone-plugin drone

drone-hugo's Introduction

drone-hugo

Build Status Gitter chat Join the discussion at https://discourse.drone.io Drone questions at https://stackoverflow.com Go Doc Go Report

Automatically create static web page files using Hugo within your Drone pipeline. For the usage information and a listing of the available options please take a look at the docs.

Build

Build the binary with the following command:

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on

go build -v -a -tags netgo -o release/linux/amd64/drone-hugo

Docker

Build the Docker image with the following command:

docker build \
  --label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
  --label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
  --file docker/Dockerfile.linux.amd64 --tag plugins/hugo .

Usage

docker run --rm \
  -e PLUGIN_HUGO_VERSION=0.00.0 \
  -e PLUGIN_BUILDDRAFTS=false \
  -e PLUGIN_BUILDEXPIRED=false \
  -e PLUGIN_BUILDFUTURE=false \
  -e PLUGIN_CACHEDIR=false \
  -e PLUGIN_CONFIG=false \
  -e PLUGIN_CONTENT=false \
  -e PLUGIN_LAYOUT=false \
  -e PLUGIN_OUTPUT=false \
  -e PLUGIN_SOURCE=false \
  -e PLUGIN_THEME=false \
  -e PLUGIN_OUTPUT=false \
  -e PLUGIN_VALIDATE=false \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  plugins/hugo:latest

drone-hugo's People

Contributors

appleboy avatar furyfire avatar mwl avatar renovate-bot avatar sofixa avatar tboerger avatar techknowlogick avatar xoxys avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drone-hugo's Issues

Unknown time zone Europe/Berlin

I'm trying to use the configuration in the docs, but I keep getting this error:

latest: Pulling from plugins/hugo
Digest: sha256:c41c437b26c2b587bd32137e3d6bba3544f92a79b4992a9b3680437ee1ec3970
Status: Image is up to date for plugins/hugo:latest
+ /tmp/401314049/852269676 check
Contains some verification checks

+ /tmp/401314049/852269676 --baseURL https://mydomain.de/
Error: invalid timeZone for language "en": unknown time zone Europe/Berlin
Total in 1 ms
exit status 255

Is there something I'm doing wrong?

My Config is down below.

config.toml:

languageCode = 'en-us'
timeZone = 'Europe/Berlin'

.drone.yml:

kind: pipeline
name: default

steps:
- name: build
  image: plugins/hugo
  settings:
    hugo_version: 0.92.0
    pull: always
    url: https://mydomain.de/
    validate: true
    extended: true

Add post-build script

I like to compress my hugo output ahead of time to prevent the webserver from compressing the files on the fly on each request.

I do this using a Makefile. It would be cool to have a parameter for this plugin to execute custom commands after the hugo build has finished.

_index.md in root content directory not rendering

Hi,
I'm having an issue related to an upgrade to 0.58.3.

For some reason the _index.md file in the content directory isn't rendering any of the markdown - I get the navigation and other content but just not seeing anything else on the page related to the markdown so the net result is the page is blank.

Just to clarify - all the other _index.md files in different directories under content render fine - its just the _index.md in the root of the content directory (which would be the page that renders when the site is launched).

On my desktop - 0.59.1 seems to work fine so having a tough time recreating this issue locally.

Any thoughts on what might be happening? Thanks!

https://discourse.drone.io/t/drone-hugo-plugin-question/6560

Hugo Extended is not working

To build Hugo with SASS support (the resources.ToCSS method is used), we need the extended version of Hugo.

See the official docs for more information.

Would that be possible? :)

Okay I found out it's already implemented, But i have no idea how to set the extended flag.
It looks like I have to use

settings:
  extended: true

But my build fails with 2019/11/12 22:15:12 : unexpected EOF

The build works on my machine with Hugo Static Site Generator v0.59.1/extended linux/amd64

I've set up a minimal demo:

https://git.f-brinker.de/fbrinker/drone-hugo-extended-demo
https://drone.f-brinker.de/fbrinker/drone-hugo-extended-demo/2/1/3

Important parts:

Add node to Dockerfile

I have already tried it on discourse, see here.

The Dockerfile additionally needs node, as there are some pipes used by hugo which require node, e.g. postcss. Does not work by adding another step to the pipeline, as hugo is needing it specifically.

Libresolv.so needed for latest hugo version

While setting hugo_version: 0.111.3, the following error is raised :

latest: Pulling from plugins/hugo
Digest: sha256:89a35ebbd5a3a06e8e1f5f39cce33f05dddfe3370012c94118093ac2a6ca9c46
Status: Image is up to date for plugins/hugo:latest
+ /tmp/hugo404086073/2623755503 --destination public_html
Error loading shared library libresolv.so.2: No such file or directory (needed by /tmp/hugo404086073/2623755503)
Error relocating /tmp/hugo404086073/2623755503: __res_search: symbol not found
exit status 127

I suppose you should just add libresolv to the installed packages in the docker images or rebuild the image. Sorry, I don't know how to test the plugin in order to submit a PR and check if this works.

Release new image with current hugo

Currently, the image contains hugo v0.40.2 but the latest version is v0.46.
I'm using a theme that requires at least v0.44.
Could you please push an updated image, containing the latest hugo version?

Error: unknown command "check" for "hugo"

Since Hugo v0.92.2 (inclusive) the hugo check ... command has been removed, and using this plugin with a version of hugo greater than or equal to v0.92.2 fails with:

Error: unknown command "check" for "hugo"

... which I believe to be because the plug-in runs a "check" on the configuration file before using it.

Would it be possible to remove that check so that the builds can work with recent hugo versions?

Otherwise we're stuck with only being able to use versions up to v0.92.1 (inclusive) only :/

curl/libcurl mismatch when installing curl

When attempting to install curl inside the docker image, a version conflict between curl and libcurl arises which causes all curl requests to fail with An unknown option was passed. Suggesting to either remove libcurl from the image or use a base image that does not have that issue.

$ docker run -it --entrypoint /bin/sh plugins/hugo
/ # apk add --no-cache curl > /dev/null
/ # curl https://gohugo.io/
curl: (48) An unknown option was passed in to libcurl

See go-gitea/gitea#22203 for more details.

hugoVersion not working

Hi,

i have set hugoVersion to the current release in my pipeline like this:

    image: cbrgm/drone-hugo:latest
    hugoVersion: 0.52

But my site get rendered wrong, which i know happends with an older hugo version. So i tried this:

image: alpine
    commands:
      - wget https://github.com/gohugoio/hugo/releases/download/v0.52/hugo_0.52_Linux-64bit.tar.gz -q -O - | tar -xz
      - ./hugo hugo -D -E -F

And all works fine. So i think there might be an issue with a custom hugoVersion. Also i think it would be better to add a version output to the used hugo command to verify currently runnning version.

Version not respected, documentation needs update

Hello and thanks for this plugin!
I want to report a few errors and bad documentation for newcomers.

  1. Currently the links to documentation go to drone-plugins/drone-hugo but it must be http://plugins.drone.io/cbrgm/drone-hugo/

  2. The documentation there states that one should set hugo_version as a variable but it is actually hugoVersion looking at your source code. So the documentation must be updated too.

  3. Using hugoVersion seems to do nothing.
    Maybe you can help here:

Drone.yml:

kind: pipeline
name: build 

steps:
- name: build
  image: plugins/hugo
  settings:
    hugoVersion: 0.67.0
  commands:
    - hugo version

Drone output:

+ hugo version
Hugo Static Site Generator v0.58.3-4AAC02D4 linux/amd64 BuildDate: 2019-09-19T15:30:47Z

Thank you!

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.