Updated to the latest Hugo version v.0.37.1, see https://github.com/gohugoio/hugo/releases
This commit is contained in:
parent
4b5f3485e1
commit
da1399608a
4 changed files with 214 additions and 20 deletions
|
|
@ -2,7 +2,7 @@ FROM alpine:latest
|
||||||
LABEL maintainer="chris@cbrgm.de"
|
LABEL maintainer="chris@cbrgm.de"
|
||||||
LABEL version="latest"
|
LABEL version="latest"
|
||||||
|
|
||||||
ENV HUGO_VERSION="0.37"
|
ARG HUGO_VERSION
|
||||||
|
|
||||||
COPY ./drone-hugo.sh /bin/
|
COPY ./drone-hugo.sh /bin/
|
||||||
RUN chmod +x /bin/drone-hugo.sh
|
RUN chmod +x /bin/drone-hugo.sh
|
||||||
|
|
|
||||||
27
Makefile
Normal file
27
Makefile
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
.PHONY: all test push build release clean
|
||||||
|
|
||||||
|
README_TEMPLATE=./docs/tmpl.md
|
||||||
|
|
||||||
|
all: release
|
||||||
|
|
||||||
|
test: Dockerfile drone-hugo.sh
|
||||||
|
docker build -t "cbrgm/drone-hugo:$(hugo)_test" --build-arg HUGO_VERSION="$(hugo)" .
|
||||||
|
|
||||||
|
build: Dockerfile drone-hugo.sh
|
||||||
|
docker build -t "cbrgm/drone-hugo:$(hugo)" --build-arg HUGO_VERSION="$(hugo)" .
|
||||||
|
docker build -t "cbrgm/drone-hugo:latest" --build-arg HUGO_VERSION="$(hugo)" .
|
||||||
|
|
||||||
|
push: build
|
||||||
|
docker push "cbrgm/drone-hugo:$(hugo)"
|
||||||
|
docker push "cbrgm/drone-hugo:latest"
|
||||||
|
|
||||||
|
release: test build push clean
|
||||||
|
sed 's/<HUGO_VERSION>/$(hugo)/g' $(README_TEMPLATE) > README.md
|
||||||
|
git add .
|
||||||
|
git commit -m "Updated to the latest Hugo version v.$(hugo), see https://github.com/gohugoio/hugo/releases"
|
||||||
|
git push origin master
|
||||||
|
|
||||||
|
clean:
|
||||||
|
docker rmi cbrgm/drone-hugo:$(hugo)
|
||||||
|
docker rmi cbrgm/drone-hugo:latest
|
||||||
|
docker rmi cbrgm/drone-hugo:$(hugo)_test
|
||||||
38
README.md
38
README.md
|
|
@ -1,6 +1,8 @@
|
||||||
# cbrgm/drone-hugo
|
# cbrgm/drone-hugo
|
||||||
|
|
||||||
[](https://github.com/cbrgm/drone-hugo/releases)   [](https://hub.docker.com/r/cbrgm/drone-hugo/tags/)
|
[](https://github.com/cbrgm/drone-hugo/releases) 
|
||||||
|

|
||||||
|
[](https://hub.docker.com/r/cbrgm/drone-hugo/tags/)
|
||||||
|
|
||||||
**Automatically create static web page files using Hugo within your drone pipeline!**
|
**Automatically create static web page files using Hugo within your drone pipeline!**
|
||||||
|
|
||||||
|
|
@ -17,7 +19,7 @@ The example below demonstrates how you can use the plugin to automatically creat
|
||||||
```yml
|
```yml
|
||||||
pipeline:
|
pipeline:
|
||||||
hugo:
|
hugo:
|
||||||
image: cbrgm/drone-hugo:latest
|
image: cbrgm/drone-hugo:0.37.1
|
||||||
validate: true
|
validate: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -30,7 +32,7 @@ You can customize the paths for e. g. the theme, layout, content directory and o
|
||||||
```yml
|
```yml
|
||||||
pipeline:
|
pipeline:
|
||||||
hugo:
|
hugo:
|
||||||
image: cbrgm/drone-hugo:latest
|
image: cbrgm/drone-hugo:0.37.1
|
||||||
+ config: path/to/config
|
+ config: path/to/config
|
||||||
+ content: path/to/content/
|
+ content: path/to/content/
|
||||||
+ layout: path/to/layout
|
+ layout: path/to/layout
|
||||||
|
|
@ -47,7 +49,7 @@ You can also define a base URL directly in the pipeline, which is used when gene
|
||||||
```yml
|
```yml
|
||||||
pipeline:
|
pipeline:
|
||||||
hugo:
|
hugo:
|
||||||
image: cbrgm/drone-hugo:latest
|
image: cbrgm/drone-hugo:0.37.1
|
||||||
config: path/to/config
|
config: path/to/config
|
||||||
content: path/to/content/
|
content: path/to/content/
|
||||||
output: path/to/public
|
output: path/to/public
|
||||||
|
|
@ -68,7 +70,7 @@ You can set the `buildDrafts`, `buildExpired`, `buildFuture` settings to configu
|
||||||
```yml
|
```yml
|
||||||
pipeline:
|
pipeline:
|
||||||
hugo:
|
hugo:
|
||||||
image: cbrgm/drone-hugo:latest
|
image: cbrgm/drone-hugo:0.37.1
|
||||||
+ buildDrafts: true
|
+ buildDrafts: true
|
||||||
+ buildExpired: true
|
+ buildExpired: true
|
||||||
+ buildFuture: true
|
+ buildFuture: true
|
||||||
|
|
@ -88,7 +90,7 @@ Here is a short example of how to define a pipeline that automatically generates
|
||||||
```yml
|
```yml
|
||||||
pipeline:
|
pipeline:
|
||||||
build:
|
build:
|
||||||
image: cbrgm/drone-hugo:latest
|
image: cbrgm/drone-hugo:0.37.1
|
||||||
output: site # Output path
|
output: site # Output path
|
||||||
validate: true
|
validate: true
|
||||||
when:
|
when:
|
||||||
|
|
@ -101,7 +103,6 @@ pipeline:
|
||||||
port: 54321
|
port: 54321
|
||||||
target: /var/www/ # Path to your web directory
|
target: /var/www/ # Path to your web directory
|
||||||
source: site/* # Copy all files from output path
|
source: site/* # Copy all files from output path
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use secrets to hide credentials:
|
You can also use secrets to hide credentials:
|
||||||
|
|
@ -109,7 +110,7 @@ You can also use secrets to hide credentials:
|
||||||
```yml
|
```yml
|
||||||
pipeline:
|
pipeline:
|
||||||
build:
|
build:
|
||||||
image: cbrgm/drone-hugo:latest
|
image: cbrgm/drone-hugo:0.37.1
|
||||||
output: site # Output path
|
output: site # Output path
|
||||||
validate: true
|
validate: true
|
||||||
when:
|
when:
|
||||||
|
|
@ -123,7 +124,6 @@ pipeline:
|
||||||
port: 54321
|
port: 54321
|
||||||
target: /var/www/ # Path to your web directory
|
target: /var/www/ # Path to your web directory
|
||||||
source: site/* # Copy all files from output path
|
source: site/* # Copy all files from output path
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Basic Usage using a Docker Container
|
## Basic Usage using a Docker Container
|
||||||
|
|
@ -148,16 +148,16 @@ docker run --rm \
|
||||||
|
|
||||||
## Parameter Reference
|
## Parameter Reference
|
||||||
|
|
||||||
`buildDrafts` - include content marked as draft
|
`buildDrafts` - include content marked as draft<br>
|
||||||
`buildExpired` - include expired content
|
`buildExpired` - include expired content<br>
|
||||||
`buildFuture` - include content with publishdate in the future
|
`buildFuture` - include content with publishdate in the future<br>
|
||||||
`config` - config file (default is path/config.yaml|json|toml)
|
`config` - config file (default is path/config.yaml|json|toml)<br>
|
||||||
`content` - filesystem path to content directory
|
`content` - filesystem path to content directory<br>
|
||||||
`layout` - filesystem path to layout directory
|
`layout` - filesystem path to layout directory<br>
|
||||||
`output` - filesystem path to write files to
|
`output` - filesystem path to write files to<br>
|
||||||
`source` - filesystem path to read files relative from
|
`source` - filesystem path to read files relative from<br>
|
||||||
`theme` - theme to use (located in /themes/THEMENAME/)
|
`theme` - theme to use (located in /themes/THEMENAME/)<br>
|
||||||
`url` - hostname (and path) to the root
|
`url` - hostname (and path) to the root<br>
|
||||||
`validate` - validate config file before generation
|
`validate` - validate config file before generation
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
||||||
167
docs/tmpl.md
Normal file
167
docs/tmpl.md
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
# cbrgm/drone-hugo
|
||||||
|
|
||||||
|
[](https://github.com/cbrgm/drone-hugo/releases) 
|
||||||
|

|
||||||
|
[](https://hub.docker.com/r/cbrgm/drone-hugo/tags/)
|
||||||
|
|
||||||
|
**Automatically create static web page files using Hugo within your drone pipeline!**
|
||||||
|
|
||||||
|
cbrgm/drone-hugo is:
|
||||||
|
|
||||||
|
- **Easy** to implement in your existing pipeline using `.drone.yml`
|
||||||
|
- **Small** 21mb image size
|
||||||
|
- **Highly configurable**
|
||||||
|
|
||||||
|
## Basic Usage with Drone CI
|
||||||
|
|
||||||
|
The example below demonstrates how you can use the plugin to automatically create static web page files using Hugo. **It's as easy as pie!**
|
||||||
|
|
||||||
|
```yml
|
||||||
|
pipeline:
|
||||||
|
hugo:
|
||||||
|
image: cbrgm/drone-hugo:<HUGO_VERSION>
|
||||||
|
validate: true
|
||||||
|
```
|
||||||
|
|
||||||
|
`validate` allows you to check your configuration file for errors before generating the files.
|
||||||
|
|
||||||
|
### Customize source, output, theme, config, layout OR content directory paths
|
||||||
|
|
||||||
|
You can customize the paths for e. g. the theme, layout, content directory and output directory and much more!
|
||||||
|
|
||||||
|
```yml
|
||||||
|
pipeline:
|
||||||
|
hugo:
|
||||||
|
image: cbrgm/drone-hugo:<HUGO_VERSION>
|
||||||
|
+ config: path/to/config
|
||||||
|
+ content: path/to/content/
|
||||||
|
+ layout: path/to/layout
|
||||||
|
+ output: path/to/public
|
||||||
|
+ source: path/to/source
|
||||||
|
+ theme: path/themes/THEMENAME/
|
||||||
|
validate: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Set hostname (and path) to the root
|
||||||
|
|
||||||
|
You can also define a base URL directly in the pipeline, which is used when generating the files.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
pipeline:
|
||||||
|
hugo:
|
||||||
|
image: cbrgm/drone-hugo:<HUGO_VERSION>
|
||||||
|
config: path/to/config
|
||||||
|
content: path/to/content/
|
||||||
|
output: path/to/public
|
||||||
|
source: path/to/source
|
||||||
|
theme: path/themes/THEMENAME/
|
||||||
|
+ url: https://cbrgm.de
|
||||||
|
validate: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build sites and include expired, drafts or future content
|
||||||
|
|
||||||
|
You can set the `buildDrafts`, `buildExpired`, `buildFuture` settings to configure the generated files.
|
||||||
|
|
||||||
|
- `buildDrafts` - include content marked as draft
|
||||||
|
- `buildExpired` - include expired content
|
||||||
|
- `buildFuture` - include content with publishdate in the future
|
||||||
|
|
||||||
|
```yml
|
||||||
|
pipeline:
|
||||||
|
hugo:
|
||||||
|
image: cbrgm/drone-hugo:<HUGO_VERSION>
|
||||||
|
+ buildDrafts: true
|
||||||
|
+ buildExpired: true
|
||||||
|
+ buildFuture: true
|
||||||
|
config: path/to/config
|
||||||
|
content: path/to/content/
|
||||||
|
output: path/to/public
|
||||||
|
source: path/to/source
|
||||||
|
theme: path/themes/THEMENAME/
|
||||||
|
url: https://cbrgm.de
|
||||||
|
validate: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Example**: Generate Hugo static files and publish them to remote directory using scp
|
||||||
|
|
||||||
|
Here is a short example of how to define a pipeline that automatically generates the static web page files with Hugo and then copies them to a remote server via scp. This makes publishing websites a breeze!
|
||||||
|
|
||||||
|
```yml
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: cbrgm/drone-hugo:<HUGO_VERSION>
|
||||||
|
output: site # Output path
|
||||||
|
validate: true
|
||||||
|
when:
|
||||||
|
branch: [ master ]
|
||||||
|
publish:
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
host: cbrgm.de
|
||||||
|
username: webuser
|
||||||
|
password: xxxxxxx
|
||||||
|
port: 54321
|
||||||
|
target: /var/www/ # Path to your web directory
|
||||||
|
source: site/* # Copy all files from output path
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use secrets to hide credentials:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: cbrgm/drone-hugo:<HUGO_VERSION>
|
||||||
|
output: site # Output path
|
||||||
|
validate: true
|
||||||
|
when:
|
||||||
|
branch: [ master ]
|
||||||
|
publish:
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
+ secrets: [ ssh_username, ssh_password ]
|
||||||
|
host: cbrgm.de
|
||||||
|
- username: webuser
|
||||||
|
- password: xxxxxxx
|
||||||
|
port: 54321
|
||||||
|
target: /var/www/ # Path to your web directory
|
||||||
|
source: site/* # Copy all files from output path
|
||||||
|
```
|
||||||
|
|
||||||
|
## Basic Usage using a Docker Container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm \
|
||||||
|
-e PLUGIN_BUILDDRAFTS=false \
|
||||||
|
-e PLUGIN_BUILDEXPIRED=false \
|
||||||
|
-e PLUGIN_BUILDFUTURE=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) \
|
||||||
|
cbrgm/drone-hugo:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameter Reference
|
||||||
|
|
||||||
|
`buildDrafts` - include content marked as draft<br>
|
||||||
|
`buildExpired` - include expired content<br>
|
||||||
|
`buildFuture` - include content with publishdate in the future<br>
|
||||||
|
`config` - config file (default is path/config.yaml|json|toml)<br>
|
||||||
|
`content` - filesystem path to content directory<br>
|
||||||
|
`layout` - filesystem path to layout directory<br>
|
||||||
|
`output` - filesystem path to write files to<br>
|
||||||
|
`source` - filesystem path to read files relative from<br>
|
||||||
|
`theme` - theme to use (located in /themes/THEMENAME/)<br>
|
||||||
|
`url` - hostname (and path) to the root<br>
|
||||||
|
`validate` - validate config file before generation
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
You have suggestions for improvements or features you miss? You are welcome to express all your wishes here. Just create a new Issue and it will be taken care of quickly!
|
||||||
|
|
||||||
|
If you are a developer yourself, you can also contribute code! Further information will follow shortly.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue