name: Check for Hugo releases on: schedule: - cron: '0 */3 * * *' # run every three hours workflow_dispatch: jobs: check: runs-on: ubuntu-latest steps: - name: Get latest Hugo version id: 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/' | tr -d "v") echo "::set-output name=VERSION::$HUGO_VERSION" - name: Get latest package version id: package_version run: | PACKAGE_VERSION=$(npm show hugo-extended version) echo "::set-output name=VERSION::$PACKAGE_VERSION" - name: Compare versions id: update run: | echo "Current package version is v${{ steps.package_version.outputs.VERSION }}." echo "Current Hugo version is v${{ steps.hugo_version.outputs.VERSION }}." if [ "${{ steps.hugo_version.outputs.VERSION }}" != "${{ steps.package_version.outputs.VERSION }}" ] then echo "🚨 Needs updating!" echo "::set-output name=UPDATE_AVAILABLE::true" exit 1 else echo "✅ All good for now." echo "::set-output name=UPDATE_AVAILABLE::false" exit 0 fi # TODO: Automatically bump npm package, commit back to repo, and publish new version.