Skip to content

Commit

Permalink
try cd
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Jul 13, 2024
1 parent d6a2047 commit affb83b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
run: docker buildx build --push --tag ghcr.io/loftwah-demo/pirate_app/pirateapp:latest .

- name: Deploy to droplet
uses: appleboy/ssh-action@master
with:
host: 170.64.189.40
username: root
key: ${{ secrets.DROPLET_SSH_PRIVATE_KEY }}
script: |
docker-compose -f /root/docker-compose.prod.yml --env-file /root/.env down
docker-compose -f /root/docker-compose.prod.yml --env-file /root/.env pull
docker-compose -f /root/docker-compose.prod.yml --env-file /root/.env up -d

0 comments on commit affb83b

Please sign in to comment.