From 09db82339b6588b8f549e0187c44b2a5f57a4c2d Mon Sep 17 00:00:00 2001 From: brookee Date: Thu, 29 Feb 2024 19:57:10 -0500 Subject: [PATCH] alt method of grabbing hugo --- .gitea/workflows/deploy.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 7ee3e58..a9efd04 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -17,11 +17,17 @@ jobs: run: | apt-get update && \ apt-get install -y jq rsync tar wget && \ - wget https://github.com/gohugoio/hugo/releases/download/v0.123.4/hugo_0.123.4_linux-amd64.tar.gz && \ - tar -xzvf hugo_0.123.4_linux-amd64.tar.gz && \ chmod +x hugo - - name: Run build task - run: ./hugo --minify --logLevel info + - name: Get latest Hugo version + run: | + url=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")) | .browser_download_url' | grep -E 'hugo_[0-9]+\.[0-9]+\.[0-9]+_linux-amd64.tar.gz') + wget -P /tmp/hugo/ "$url" + version=$(echo "$url" | grep -oP 'hugo_\K[0-9]+\.[0-9]+\.[0-9]+') + echo "Downloaded Hugo version: $version" + - name: Unpack Hugo + run: tar -xf /tmp/hugo/* -C ${{ gitea.workspace }}/bin + - name: Build the static webpage + run: ${{ gitea.workspace }}/bin/hugo --minify - name: Test static page run: bash ${{ gitea.workspace }}/bin/test_static_page.sh - name: Deploy to Server