tobiasmanske.de/.drone.yml

74 lines
1.7 KiB
YAML
Raw Normal View History

2022-10-31 18:03:30 +01:00
---
2022-06-07 22:27:47 +02:00
kind: pipeline
type: docker
name: default
trigger:
branch:
- master
event:
include:
- push
- cron
- custom
steps:
- name: submodules
image: alpine/git
commands:
- git submodule update --init --recursive
- name: Compress Images
image: registry.tobiasmanske.de/docker-avif-webp:latest
secrets: [registry]
depends_on:
- submodules
2022-11-27 00:10:42 +01:00
- name: Check for new posts
image: klakegg/hugo:alpine
pull: always
commands:
# If this is a cronjob and there are no new pages to publish fail successfully (exit status 78)
- export TIMESTAMP_YESTERDAY=$(date -d @$(($(date +%s) - 86400)) -u +"%Y-%m-%dT%H:%M:%SZ")
- export POST_YESTERDAY=$(hugo list future --clock $TIMESTAMP_YESTERDAY | md5sum)
- export POST_TODAY=$(hugo list future | md5sum)
- if [ "$POST_YESTERDAY" = "$POST_TODAY" ]; then exit 78; fi
- exit 0
depends_on:
- Compress Images
- submodules
when:
event:
- cron
2022-06-07 22:27:47 +02:00
- name: Build HTML
image: klakegg/hugo:alpine
commands:
- hugo --minify
depends_on:
- Compress Images
- submodules
2022-11-27 00:10:42 +01:00
- Check for new posts
2022-06-07 22:27:47 +02:00
- name: Build Image
image: plugins/docker
settings:
repo: registry.tobiasmanske.de/tobiasmanske.de
force_tag: true
registry: registry.tobiasmanske.de
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- latest
- ${DRONE_BRANCH}
cache_from:
- "registry.tobiasmanske.de/tobiasmanske.de:master"
- "registry.tobiasmanske.de/tobiasmanske.de:${DRONE_BRANCH}"
depends_on:
- Build HTML
image_pull_secrets:
- registry