From 3acd4fd82a3c91ccb1afbc92fc62ca0b5ec2f084 Mon Sep 17 00:00:00 2001 From: mafyuh Date: Sun, 9 Jun 2024 04:51:20 +0000 Subject: [PATCH] Add scripts/deploy.sh --- scripts/deploy.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/deploy.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000..d51f7bc --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Get folder name from command-line argument +folder="$1" +echo "Deploying to folder: $folder" + +case $folder in + arrs) + host="${{ secrets.ARRS_IP }}" + ;; + ag_main) + host="${{ secrets.AGMAIN_IP }}" + ;; + downloaders) + host="${{ secrets.DOWNLOADERS_IP }}" + ;; + # Add cases for other folders/hosts + *) + echo "Unknown folder: $folder" + exit 1 + ;; +esac + +echo "Deploying to host: $host" + +# SSH command to deploy to the host +ssh -o StrictHostKeyChecking=no mafyuh@$host "cd /Auto-Homelab/$folder && git pull && docker-compose up -d" || echo "Failed to deploy to $host for folder $folder"