61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
when:
|
|
- branch: [main]
|
|
event: push
|
|
path:
|
|
include: ['Website/**']
|
|
on_empty: false
|
|
|
|
steps:
|
|
- name: log_start_time
|
|
image: alpine
|
|
commands:
|
|
- date -I'seconds'
|
|
|
|
- name: build_by_hugo
|
|
image: alpine:3.21 # hugomods/hugo # vs image: alpine >= 3.21, damit Hugo-Version >= 0.139
|
|
commands:
|
|
- date -I'seconds'
|
|
- cat /etc/alpine-release
|
|
- apk add --no-cache hugo
|
|
- hugo version
|
|
|
|
- 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 $?
|
|
|
|
- grep -E "Du hast sogar schon mal selbst Materialien erstellt oder arbeitest in einer Community" Website/PROD/index.html
|
|
|
|
- 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
|
|
DOMAIN_FOLDER:
|
|
from_secret: domain_folder
|
|
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
|
|
- ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "touch $DOMAIN_FOLDER/Log/time_begin_copy_$(date +'%Y-%m-%d_%T')"
|
|
- scp -r -i ~/.ssh/deployKey -P $SSH_PORT Website/PROD/* $SSH_USER@$SSH_HOST:$DOMAIN_FOLDER/$TARGET_PATH/
|
|
- 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'
|