Add .onedev-buildspec.yml
This commit is contained in:
50
.onedev-buildspec.yml
Normal file
50
.onedev-buildspec.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
version: 46
|
||||||
|
jobs:
|
||||||
|
- name: Deploy
|
||||||
|
steps:
|
||||||
|
- type: CommandStep
|
||||||
|
name: Deploy
|
||||||
|
runInContainer: true
|
||||||
|
image: ubuntu:latest
|
||||||
|
interpreter:
|
||||||
|
type: DefaultInterpreter
|
||||||
|
commands: |
|
||||||
|
# 1. Install SSH client in this temporary CI container
|
||||||
|
apt-get update && apt-get install -y openssh-client
|
||||||
|
|
||||||
|
# 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. SSH into the host machine to execute the deployment
|
||||||
|
# Replace YOUR_HOST_LAN_IP with your machine's actual IP address (e.g. 192.168.1.50)
|
||||||
|
ssh adipu@@172.17.0.1 << 'EOF'
|
||||||
|
set -e
|
||||||
|
echo "==> Navigating to project directory..."
|
||||||
|
cd ~/LabWise
|
||||||
|
|
||||||
|
echo "==> Pulling latest code..."
|
||||||
|
git pull origin 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