2024-12-03 07:53:55 +00:00
|
|
|
when:
|
2024-12-03 08:13:24 +00:00
|
|
|
- branch: main
|
2024-12-03 08:00:48 +00:00
|
|
|
event: push
|
|
|
|
path:
|
2024-12-03 08:13:24 +00:00
|
|
|
include: ['sb/**']
|
2024-12-03 07:53:55 +00:00
|
|
|
on_empty: false
|
2024-10-30 08:01:25 +00:00
|
|
|
|
2024-12-03 07:53:55 +00:00
|
|
|
steps:
|
2024-12-03 09:10:24 +00:00
|
|
|
- name: log_start_time
|
|
|
|
image: alpine
|
|
|
|
commands:
|
2024-12-03 10:27:03 +00:00
|
|
|
- date -I'seconds'
|
|
|
|
- adjtimex
|
2024-12-03 09:10:24 +00:00
|
|
|
|
2024-10-30 08:01:25 +00:00
|
|
|
- name: build_by_hugo
|
|
|
|
image: hugomods/hugo
|
|
|
|
commands:
|
|
|
|
- hugo version
|
2024-12-03 07:53:55 +00:00
|
|
|
- hugo -s sb --logLevel info
|
2024-10-30 08:01:25 +00: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 09:44:10 +00:00
|
|
|
DOMAIN_FOLDER:
|
|
|
|
from_secret: domain_folder
|
2024-10-30 08:01:25 +00: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
|
2024-12-03 10:14:16 +00:00
|
|
|
- ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "touch $DOMAIN_FOLDER/log/time_begin_copy_$(date +'%Y-%m-%d_%T_%N')"
|
2024-12-03 09:44:10 +00:00
|
|
|
- scp -r -i ~/.ssh/deployKey -P $SSH_PORT sb/public/* $SSH_USER@$SSH_HOST:$DOMAIN_FOLDER/$TARGET_PATH/
|
2024-12-03 10:14:16 +00:00
|
|
|
- ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "touch $DOMAIN_FOLDER/log/time_end_copy_$(date +'%Y-%m-%d_%T_%N')"
|