summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCrystal <crystal@wizard.tower>2024-04-19 19:19:23 +0100
committerCrystal <crystal@wizard.tower>2024-04-19 19:19:23 +0100
commit38efdebedba539e1f2279fee4d513b5c2f8f6443 (patch)
tree555f9fad514b623b4d5e797818333786c9832c75
parent7f1258ae6f9971bc2a22c7fe2672d90ee976b1f6 (diff)
downloadwww-38efdebedba539e1f2279fee4d513b5c2f8f6443.tar.gz
drone.yml
-rw-r--r--.drone.yml33
1 files changed, 33 insertions, 0 deletions
diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..a5b7eec
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,33 @@
+kind: pipeline
+name: ssh_and_execute
+
+# Define a step to execute the SSH command on the server
+steps:
+  - name: ssh_execute
+    image: alpine:latest  # Lightweight base image (adjust if needed)
+    # Fetch the private key securely from Drone secrets
+    script: |
+      set -e  # Exit on failure
+
+      # Replace 'SSH_KEY_SECRET' with the actual secret name in Drone
+      KEY_DATA=$(drone secret get SSH_KEY_SECRET)
+      # Ensure key data is not accidentally logged
+      echo "$KEY_DATA" | tr -d '\r' > /tmp/drone_key  # Remove carriage returns (if any) and store in temp file
+
+      chmod 600 /tmp/drone_key  # Set strict permissions
+      eval "$(ssh-agent -s)"  # Start SSH agent
+
+      # Add the private key to the agent securely
+      ssh-add /tmp/drone_key
+
+      # Replace with actual server details (host, username, command)
+      ssh crystal@tilde.institute -i /tmp/drone_key "touch hello_im_emu"
+
+      # Clean up after use
+      rm -f /tmp/drone_key  # Remove temporary key file
+
+# Trigger the pipeline on branch merge events
+trigger:
+  - type: git
+    branch:
+      - master  # Adjust branch name(s) as needed