Skip to content

Commit

Permalink
fix: .ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
d.pikaliuk committed Jan 12, 2024
1 parent ffeebec commit c94beed
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,26 @@ jobs:
PASS: ${{ secrets.DO_PASSKEY }}
# Add any other environment variables if needed
run: |
# Install SSH client
# Install SSH client (if not already installed)
sudo apt-get update
sudo apt-get install -y openssh-client
# Start SSH agent and add key
eval "$(ssh-agent -s)"
echo "$SSH_PRIVATE_KEY" | ssh-add -
# Disable host key checking (for automation)
# Create .ssh directory and known_hosts file
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
chmod 700 ~/.ssh
chmod 644 ~/.ssh/known_hosts
# Add the host key to known_hosts
ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts
# SSH into the Digital Ocean server and pull the latest image and restart services
# SSH into the Digital Ocean server and run deployment commands
ssh -o 'StrictHostKeyChecking=no' root@$HOST << 'ENDSSH'
cd /path/to/your/app
docker-compose pull
docker-compose up -d
ENDSSH
ENDSSH

0 comments on commit c94beed

Please sign in to comment.