This commit is contained in:
@@ -1,53 +0,0 @@
|
|||||||
version: 46
|
|
||||||
jobs:
|
|
||||||
- name: Deploy
|
|
||||||
steps:
|
|
||||||
- type: CommandStep
|
|
||||||
name: Deploy
|
|
||||||
runInContainer: true
|
|
||||||
image: ubuntu:latest
|
|
||||||
interpreter:
|
|
||||||
type: DefaultInterpreter
|
|
||||||
commands: |
|
|
||||||
# 1. Install SSH client and IP routing tools
|
|
||||||
apt-get update && apt-get install -y openssh-client iproute2
|
|
||||||
|
|
||||||
# 2. Setup the SSH key from OneDev secrets
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "@secret:DEPLOY_SSH_KEY@" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
echo "StrictHostKeyChecking no" > ~/.ssh/config
|
|
||||||
|
|
||||||
# 3. Dynamically find the Host machine's IP address
|
|
||||||
HOST_IP=$(ip route | awk '/default/ { print $3 }')
|
|
||||||
echo "==> Detected Host IP: $HOST_IP"
|
|
||||||
|
|
||||||
# 4. SSH into the host machine to execute the deployment
|
|
||||||
ssh adipu@@$HOST_IP << 'EOF'
|
|
||||||
set -e
|
|
||||||
echo "==> Navigating to project directory..."
|
|
||||||
cd ~/LabWise
|
|
||||||
|
|
||||||
echo "==> Pulling latest code..."
|
|
||||||
git pull onedev main
|
|
||||||
|
|
||||||
echo "==> Running Test Build..."
|
|
||||||
docker compose build
|
|
||||||
|
|
||||||
echo "==> Build successful! Deploying new containers..."
|
|
||||||
docker compose up -d
|
|
||||||
|
|
||||||
echo "==> Deployment Complete!"
|
|
||||||
EOF
|
|
||||||
useTTY: true
|
|
||||||
condition: SUCCESSFUL
|
|
||||||
optional: false
|
|
||||||
triggers:
|
|
||||||
- type: BranchUpdateTrigger
|
|
||||||
branches: main
|
|
||||||
userMatch: anyone
|
|
||||||
projects: LabWise
|
|
||||||
retryCondition: never
|
|
||||||
maxRetries: 3
|
|
||||||
retryDelay: 30
|
|
||||||
timeout: 14400
|
|
||||||
Reference in New Issue
Block a user