ci: add base_url

This commit is contained in:
Matthieu Bessat 2024-03-10 23:51:44 +01:00
parent d589da2263
commit 08584efc5f

View file

@ -15,6 +15,15 @@ jobs:
container: container:
image: code.forgejo.org/oci/node:20-bookworm image: code.forgejo.org/oci/node:20-bookworm
steps: 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 - name: Install rsync
run: apt update && apt install -y rsync run: apt update && apt install -y rsync
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -33,7 +42,8 @@ jobs:
tar -xvzf hugo.tar.gz tar -xvzf hugo.tar.gz
mv hugo /usr/local/bin mv hugo /usr/local/bin
- name: Build - name: Build
run: hugo --minify run: |
hugo --baseURL="$(cat /base_url.txt)"
- name: Create Key File - name: Create Key File
run: install -m 600 -D /dev/null ~/.ssh/id_edsa run: install -m 600 -D /dev/null ~/.ssh/id_edsa
- name: Populate Key - name: Populate Key
@ -44,7 +54,7 @@ jobs:
REMOTE_USER: forgejo_actions_websites REMOTE_USER: forgejo_actions_websites
SRV_HOST: srv06.lefuturiste.fr SRV_HOST: srv06.lefuturiste.fr
run: | run: |
rsync --perms --archive --stats -v \ rsync --perms --archive --stats \
-e 'ssh -i ~/.ssh/id_edsa -o StrictHostKeyChecking=no' ./public \ -e 'ssh -i ~/.ssh/id_edsa -o StrictHostKeyChecking=no' ./public \
$REMOTE_USER@$SRV_HOST:$OUTPUT_PATH$GITHUB_REF_NAME $REMOTE_USER@$SRV_HOST:$OUTPUT_PATH$GITHUB_REF_NAME