Skip to content

Commit

Permalink
CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoom-Developer committed Nov 2, 2024
1 parent da2adf9 commit 620cdd5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy

on:
push:
branches:
- main

jobs:
build-and-run:
runs-on: ubuntu-latest

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

- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Sync with server
run: |
rsync -avz --exclude='.env' ./ ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:${{ secrets.SERVER_DIR }}
- name: Build and run
env:
SERVER_USER: ${{ secrets.SERVER_USER }}
SERVER_HOST: ${{ secrets.SERVER_HOST }}
SERVER_DIR: ${{ secrets.SERVER_DIR }}
run: |
ssh $SERVER_USER@$SERVER_HOST << EOF
cd $SERVER_DIR
docker compose up -d --build
EOF

0 comments on commit 620cdd5

Please sign in to comment.