From 109d1b723a751f758e3f859b896c3f3bcd2305d6 Mon Sep 17 00:00:00 2001 From: Vezpi Date: Thu, 1 May 2025 23:30:16 +0200 Subject: [PATCH] Create Gitea Actions to deploy the blog with hugo --- .gitea/workflows/deploy_blog.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .gitea/workflows/deploy_blog.yml diff --git a/.gitea/workflows/deploy_blog.yml b/.gitea/workflows/deploy_blog.yml new file mode 100644 index 0000000..bf488f3 --- /dev/null +++ b/.gitea/workflows/deploy_blog.yml @@ -0,0 +1,31 @@ +name: Deploy +on: [push] +jobs: + Deploy: + runs-on: ubuntu + env: + BLOG_FOLDER: /blog + container: + volumes: + - /appli/data/blog:/blog + steps: + - name: Install prerequisites + run: apt update && apt install -y jq + + - name: Check out repository + uses: actions/checkout@v4 + + - name: Get current Hugo version + run: echo "current_version=$(${BLOG_FOLDER}/bin/current/hugo version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')" | tee -a $GITEA_ENV + + - name: Verify latest Hugo version + run: echo "latest_version=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r .tag_name)" | tee -a $GITEA_ENV + + - name: Download latest Hugo version + if: env.current_version != env.latest_version + run: | + curl -L https://github.com/gohugoio/hugo/releases/download/$latest_version/hugo_extended_${latest_version#v}_Linux-64bit.tar.gz -o hugo.tar.gz + tar -xzvf hugo.tar.gz -C ${BLOG_FOLDER}/bin/current/ + + - name: Generate the static files with Hugo + run: ${BLOG_FOLDER}/bin/current/hugo -s ${BLOG_FOLDER} -d ${BLOG_FOLDER}/public