Skip to content

Deploy to Production #3

Deploy to Production

Deploy to Production #3

name: Deploy to Production
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Tailscale
run: |
sudo curl -fsSL https://tailscale.com/install.sh | sh
- name: Authenticate with Tailscale
env:
TAILSCALE_AUTH_KEY: ${{ secrets.TAILSCALE_AUTH_KEY }}
run: |
sudo tailscale up --authkey=$TAILSCALE_AUTH_KEY
echo "Tailscale IPs: $(tailscale ip -4)"
- name: Add SSH private key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
shell: bash
- name: Deploy via SSH
env:
SERVER_IP: ${{ secrets.SERVER_TAILSCALE_IP }}
run: |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa user@$SERVER_IP << 'EOF'
cd /var/www/
sudo bash deploy-code/deploy-update.sh branch origin/main
EOF