2024-12-03 08:53:55 +01:00
when :
2025-05-26 12:25:50 +02:00
- branch : [ main]
2024-12-03 09:00:48 +01:00
event : push
path :
2025-04-01 10:23:38 +02:00
include : [ 'Website/**' ]
2024-12-03 08:53:55 +01:00
on_empty : false
2024-10-30 09:01:25 +01:00
2024-12-03 08:53:55 +01:00
steps :
2024-12-03 10:10:24 +01:00
- name : log_start_time
image : alpine
commands :
2024-12-03 11:27:03 +01:00
- date -I'seconds'
2024-12-03 10:10:24 +01:00
2024-10-30 09:01:25 +01:00
- name : build_by_hugo
2025-05-26 12:25:50 +02:00
image: alpine:3.21 # hugomods/hugo # vs image : alpine >= 3.21, damit Hugo-Version >= 0.139
2024-10-30 09:01:25 +01:00
commands :
2025-05-26 12:25:50 +02:00
- date -I'seconds'
- cat /etc/alpine-release
- apk add --no-cache hugo
2024-10-30 09:01:25 +01:00
- hugo version
2025-05-26 12:25:50 +02:00
- mkdir Website/PROD
- hugo -s Website -d PROD --logLevel debug
- ls -la Website/PROD/index.html
- if grep -E "Team vollständig" Website/PROD/index.html; then echo "Blog Teamseite"; else echo "Webseite Startseite"; fi
- echo $?
2024-10-30 09:01:25 +01:00
2025-05-26 13:47:39 +02:00
- grep -E "Du hast sogar schon mal selbst Materialien erstellt oder arbeitest in einer Community" Website/PROD/index.html
2024-10-30 09:01:25 +01:00
- name : copy_to_server
image : alpine
environment :
SSH_HOST :
from_secret : ssh_host
SSH_USER :
from_secret : ssh_user
SSH_KEY :
from_secret : ssh_key
SSH_PORT :
from_secret : ssh_port
2024-12-03 10:44:10 +01:00
DOMAIN_FOLDER :
from_secret : domain_folder
2024-10-30 09:01:25 +01:00
TARGET_PATH :
from_secret : target_path
commands :
- apk add --no-cache openssh
- mkdir -p ~/.ssh
- echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/deployKey
- chmod 600 ~/.ssh/deployKey
- ssh-keyscan -H -p $SSH_PORT $SSH_HOST 2>/dev/null >> ~/.ssh/known_hosts
- chmod 600 ~/.ssh/known_hosts
2025-04-01 10:23:38 +02:00
- ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "touch $DOMAIN_FOLDER/Log/time_begin_copy_$(date +'%Y-%m-%d_%T')"
2025-05-26 12:25:50 +02:00
- scp -r -i ~/.ssh/deployKey -P $SSH_PORT Website/PROD/* $SSH_USER@$SSH_HOST:$DOMAIN_FOLDER/$TARGET_PATH/
2026-01-27 16:12:36 +01:00
- if ! grep -E "<p>FOERBICO is a research project which " Website/PROD/en/index.html; then ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "cp $DOMAIN_FOLDER/www_stable/en/index.html $DOMAIN_FOLDER/$TARGET_PATH/en/"; fi
2026-01-27 16:38:28 +01:00
- echo hier
2025-04-01 10:23:38 +02:00
- ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "touch $DOMAIN_FOLDER/Log/time_end_copy_$(date +'%Y-%m-%d_%T')"
- name : log_end_time
image : alpine
commands :
- date -I'seconds'