From 4067aa74b2c56405d42d85b0e5aa65f43d77d026 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Sun, 27 Nov 2022 00:10:42 +0100 Subject: [PATCH] CI: Only update image on new releases --- .drone.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.drone.yml b/.drone.yml index e389915..7b31d48 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,6 +24,23 @@ steps: depends_on: - submodules + - 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 + - name: Build HTML image: klakegg/hugo:alpine commands: @@ -31,6 +48,7 @@ steps: depends_on: - Compress Images - submodules + - Check for new posts - name: Build Image image: plugins/docker