diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f6d3da4 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ +name: Deploy to DigitalOcean + +on: + push: + branches: + - setup/digital-ocean + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build Docker image + run: docker build -t abibliadigital:latest . + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Copy Docker image to DigitalOcean + run: | + docker save abibliadigital:latest | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bunzip2 | docker load' + + - name: Deploy to DigitalOcean + run: | + ssh root@${{ secrets.DROPLET_IP }} "docker-compose -f /path/to/docker-compose.yml up -d"