mirror of
https://github.com/jakejarvis/hugo-extended.git
synced 2025-04-27 13:36:22 -04:00
41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
name: Check for Hugo releases
|
|
|
|
# TODO: instead of failing CI, send a notification via email/slack/twilio/etc.
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 */3 * * *' # run every three hours
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
steps:
|
|
- name: Get latest Hugo version
|
|
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
|
|
run: |
|
|
HUGO_VERSION=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
|
echo "::set-env name=HUGO_VERSION::$HUGO_VERSION"
|
|
- name: Get latest package version
|
|
run: |
|
|
PACKAGE_VERSION=v$(npm show hugo-extended version) # prepend v to match above format
|
|
echo "::set-env name=PACKAGE_VERSION::$PACKAGE_VERSION"
|
|
- name: Compare versions
|
|
run: |
|
|
echo "Current Hugo version is $HUGO_VERSION."
|
|
echo "Current package version is $PACKAGE_VERSION."
|
|
|
|
if [ "$HUGO_VERSION" != "$PACKAGE_VERSION" ]
|
|
then
|
|
echo "🚨 Needs updating!"
|
|
echo "::set-env name=UPDATE_AVAILABLE::true"
|
|
exit 1
|
|
else
|
|
echo "✅ All good for now."
|
|
echo "::set-env name=UPDATE_AVAILABLE::false"
|
|
exit 0
|
|
fi
|