From 813cb65cd51527e1c6a57e61c749ac0f48eae828 Mon Sep 17 00:00:00 2001 From: samsepi0l Date: Fri, 24 Mar 2023 23:11:29 +0100 Subject: [PATCH] Add workflow It will update HUGO_VERSION variable in netlify.toml Signed-off-by: samsepi0l --- .github/workflows/hugo-version_workflow.yml | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/hugo-version_workflow.yml diff --git a/.github/workflows/hugo-version_workflow.yml b/.github/workflows/hugo-version_workflow.yml new file mode 100644 index 0000000..0f571ba --- /dev/null +++ b/.github/workflows/hugo-version_workflow.yml @@ -0,0 +1,25 @@ +name: Update Hugo Version + +on: + schedule: + - cron: '0 0 * * *' # Run daily at midnight + workflow_dispatch: # Allow manual triggering + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get latest Hugo version + id: hugo-version + run: echo "::set-output name=version::$(curl --silent https://api.github.com/repos/gohugoio/hugo/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')" + + - name: Update netlify.toml + run: sed -i "s/HUGO_VERSION = \".*\"/HUGO_VERSION = \"${{ steps.hugo-version.outputs.version }}\"/" netlify.toml + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'Update Hugo version'