Skip to content

explicit debug

explicit debug #16

Workflow file for this run

name: Build and Deploy
on:
push:
branches: [ database ]
pull_request:
branches: [ database ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: kortregt/draftreview:latest
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts
- name: Test SSH connection
run: ssh -i ~/.ssh/id_ed25519 -v root@${{ secrets.DROPLET_IP }} "echo 'SSH connection successful'"
- name: Deploy to Digital Ocean
run: |
ssh -i ~/.ssh/id_ed25519 root@${{ secrets.DROPLET_IP }} "mkdir -p /opt/draftbot"
scp -i ~/.ssh/id_ed25519 docker-compose.yml root@${{ secrets.DROPLET_IP }}:/opt/draftbot/
ssh -i ~/.ssh/id_ed25519 root@${{ secrets.DROPLET_IP }} 'cd /opt/draftbot && echo -e "BotToken=${{ secrets.BOT_TOKEN }}\nWIKI_BOT_PASSWORD=${{ secrets.WIKI_BOT_PASSWORD }}" > .env && docker compose pull && docker compose up -d'