From 5f919e0be2f24dca573b1f7638fc632cb52a945d Mon Sep 17 00:00:00 2001
From: Ludger Sicking <sicking@comenius.de>
Date: Wed, 12 Mar 2025 09:16:51 +0100
Subject: [PATCH] Pipeline mit "scp" zur Aktualisierung des gantt-Charts

---
 .woodpecker/publish-gantt-markdown.yaml | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 .woodpecker/publish-gantt-markdown.yaml

diff --git a/.woodpecker/publish-gantt-markdown.yaml b/.woodpecker/publish-gantt-markdown.yaml
new file mode 100644
index 0000000..030e2dd
--- /dev/null
+++ b/.woodpecker/publish-gantt-markdown.yaml
@@ -0,0 +1,41 @@
+when:
+  - event: push
+    #branch: main
+    branch: feature/*
+    path:
+      include: ['/**/*gantt*md'] # richtig? oder geht "nur" '/**/*gantt.md'?
+      #~/foerbico-projekplan-gantt.md
+      on_empty: false
+
+steps:
+  - name: log_start_time
+    image: alpine
+    commands:
+      - date -I'seconds'
+
+  - 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_GANTT:
+        from_secret: target_path_gantt
+
+    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 foerbico-projekplan-gantt.md $SSH_USER@$SSH_HOST:$DOMAIN_FOLDER/$TARGET_PATH_GANTT/gantt.md
+      - ssh -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "touch $DOMAIN_FOLDER/log/time_end_copy_$(date +'%Y-%m-%d_%T')"
\ No newline at end of file