From 7607981d78aa79ad3b31ea70766db063071b88cf Mon Sep 17 00:00:00 2001 From: Ludger Sicking Date: Mon, 4 Nov 2024 12:45:44 +0100 Subject: [PATCH] wo "lebt" $BLOG_FOLDER? --- .woodpecker/build_and_copy_blog.yaml | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .woodpecker/build_and_copy_blog.yaml diff --git a/.woodpecker/build_and_copy_blog.yaml b/.woodpecker/build_and_copy_blog.yaml new file mode 100644 index 0000000..964c805 --- /dev/null +++ b/.woodpecker/build_and_copy_blog.yaml @@ -0,0 +1,51 @@ +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 + - sed "s+'//oer.community/'+'//oer.community/sb/${CI_COMMIT_BRANCH}/'+" sb/hugo.yaml > hugo-changed.yaml + - cat sb/hugo.yaml + - cat hugo-changed.yaml + - mv hugo-changed.yaml sb/hugo.yaml + - find . -name "*hugo*ml" + + - name: build_by_hugo + image: hugomods/hugo + commands: + - hugo version + - 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: + - BLOG_FOLDER=$TARGET_PATH/sb/${CI_COMMIT_BRANCH} + - echo $BLOG_FOLDER + + - 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 "mkdir -p $BLOG_FOLDER" + - #scp -r -i ~/.ssh/deployKey -P $SSH_PORT sb/public/* $SSH_USER@$SSH_HOST:$BLOG_FOLDER/ + + - SSH_COMMAND="touch $BLOG_FOLDER/touchdown-txt_dot-log" + - ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST $SSH_COMMAND + - ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST 'ls -la'