2024-10-16 10:23:31 +00:00
|
|
|
when:
|
|
|
|
- event: push
|
|
|
|
|
2024-10-16 09:58:54 +00:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: set_path_for_branch
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- echo 'step= set_path_for_branch'
|
|
|
|
- echo "PATH_FOR_BRANCH=$CI_COMMIT_BRANCH" >> environment_variables
|
|
|
|
- cat environment_variables
|
2024-10-16 10:19:02 +00:00
|
|
|
- sed "s|sb/'|sb/${CI_COMMIT_BRANCH}/'|" sb/hugo.yaml > hugo-changed.yaml
|
2024-10-16 09:58:54 +00:00
|
|
|
- cat sb/hugo.yaml
|
|
|
|
- cat hugo-changed.yaml
|
2024-10-16 10:25:51 +00:00
|
|
|
- mv hugo-changed.yaml sb/hugo.yaml
|
2024-10-16 09:58:54 +00:00
|
|
|
# nur zum Prüfen, was es an Hugo Konfigs gibt
|
|
|
|
- find . -name "*hugo*yaml"
|
|
|
|
- find . -name "*hugo*toml"
|
|
|
|
|
|
|
|
- name: build_by_hugo
|
|
|
|
image: hugomods/hugo
|
|
|
|
commands:
|
|
|
|
- hugo version
|
2024-10-30 04:39:01 +00:00
|
|
|
- git -C sb submodule update --init --recursive
|
2024-10-16 09:58:54 +00:00
|
|
|
- hugo --cleanDestinationDir -s sb --logLevel info
|
|
|
|
|
|
|
|
- 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
|
|
|
|
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
|
|
|
|
|
2024-10-16 10:38:21 +00:00
|
|
|
- ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "mkdir -p $TARGET_PATH"
|
|
|
|
- scp -r -i ~/.ssh/deployKey -P $SSH_PORT sb/public/* $SSH_USER@$SSH_HOST:$TARGET_PATH/
|