From 08584efc5f99030bb9754d513b6acc3d9a1081b6 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sun, 10 Mar 2024 23:51:44 +0100 Subject: [PATCH] ci: add base_url --- .forgejo/workflows/hugo.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/hugo.yaml b/.forgejo/workflows/hugo.yaml index 42e3368..5a9e2d5 100644 --- a/.forgejo/workflows/hugo.yaml +++ b/.forgejo/workflows/hugo.yaml @@ -15,6 +15,15 @@ jobs: container: image: code.forgejo.org/oci/node:20-bookworm steps: + - name: Set baseURL + shell: /bin/bash + run: | + if [[ "${{ env.github_ref_name }}" == "master" ]]; then + echo -n "https://etoiledebethleem.fr" > /base_url.txt + fi + if [[ "${{ env.github_ref_name }}" == "develop" ]]; then + echo -n "https://preview.etoiledebethleem.fr" > /base_url.txt + fi - name: Install rsync run: apt update && apt install -y rsync - uses: actions/checkout@v4 @@ -33,7 +42,8 @@ jobs: tar -xvzf hugo.tar.gz mv hugo /usr/local/bin - name: Build - run: hugo --minify + run: | + hugo --baseURL="$(cat /base_url.txt)" - name: Create Key File run: install -m 600 -D /dev/null ~/.ssh/id_edsa - name: Populate Key @@ -44,7 +54,7 @@ jobs: REMOTE_USER: forgejo_actions_websites SRV_HOST: srv06.lefuturiste.fr run: | - rsync --perms --archive --stats -v \ + rsync --perms --archive --stats \ -e 'ssh -i ~/.ssh/id_edsa -o StrictHostKeyChecking=no' ./public \ $REMOTE_USER@$SRV_HOST:$OUTPUT_PATH$GITHUB_REF_NAME