You've already forked hugo-extended
mirror of
https://github.com/jakejarvis/hugo-extended.git
synced 2026-06-13 01:45:29 -04:00
clean up version-checking workflow (#42)
TODO: Automatically bump npm package, commit back to repo, and publish new version.
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
name: Check for Hugo releases
|
name: Check for Hugo releases
|
||||||
|
|
||||||
# TODO: instead of failing CI, send a notification via email/slack/twilio/etc.
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 */3 * * *' # run every three hours
|
- cron: '0 */3 * * *' # run every three hours
|
||||||
@@ -10,31 +8,33 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: Get latest Hugo version
|
- name: Get latest Hugo version
|
||||||
|
id: hugo_version
|
||||||
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
|
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
|
||||||
run: |
|
run: |
|
||||||
HUGO_VERSION=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
HUGO_VERSION=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d "v")
|
||||||
echo "::set-env name=HUGO_VERSION::$HUGO_VERSION"
|
echo "::set-output name=VERSION::$HUGO_VERSION"
|
||||||
- name: Get latest package version
|
- name: Get latest package version
|
||||||
|
id: package_version
|
||||||
run: |
|
run: |
|
||||||
PACKAGE_VERSION=v$(npm show hugo-extended version) # prepend v to match above format
|
PACKAGE_VERSION=$(npm show hugo-extended version)
|
||||||
echo "::set-env name=PACKAGE_VERSION::$PACKAGE_VERSION"
|
echo "::set-output name=VERSION::$PACKAGE_VERSION"
|
||||||
- name: Compare versions
|
- name: Compare versions
|
||||||
|
id: update
|
||||||
run: |
|
run: |
|
||||||
echo "Current Hugo version is $HUGO_VERSION."
|
echo "Current package version is v${{ steps.package_version.outputs.VERSION }}."
|
||||||
echo "Current package version is $PACKAGE_VERSION."
|
echo "Current Hugo version is v${{ steps.hugo_version.outputs.VERSION }}."
|
||||||
|
|
||||||
if [ "$HUGO_VERSION" != "$PACKAGE_VERSION" ]
|
if [ "${{ steps.hugo_version.outputs.VERSION }}" != "${{ steps.package_version.outputs.VERSION }}" ]
|
||||||
then
|
then
|
||||||
echo "🚨 Needs updating!"
|
echo "🚨 Needs updating!"
|
||||||
echo "::set-env name=UPDATE_AVAILABLE::true"
|
echo "::set-output name=UPDATE_AVAILABLE::true"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "✅ All good for now."
|
echo "✅ All good for now."
|
||||||
echo "::set-env name=UPDATE_AVAILABLE::false"
|
echo "::set-output name=UPDATE_AVAILABLE::false"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: Automatically bump npm package, commit back to repo, and publish new version.
|
||||||
|
|||||||
Reference in New Issue
Block a user