Skip to content

Commit

Permalink
Create github action for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Alputer authored Jan 21, 2024
1 parent d19af93 commit 9c93b28
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ec2-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy-to-EC2

on:
push:
branches:
- main
paths:
- "./src"
- ".github/workflows/ec2-deploy.yml"
jobs:
deploy:
name: Deploy to EC2
runs-on: ubuntu-latest

steps:
- name: Checkout the files
uses: actions/checkout@v2

- name: Deploy to server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
REMOTE_HOST: ${{ secrets.HOST_DNS }}
REMOTE_USER: ${{ secrets.USERNAME }}
TARGET: ${{ secrets.TARGET_DIR }}
ARGS: --delete
EXCLUDE: prod.env
SCRIPT_AFTER: |
cd ${{ secrets.TARGET_DIR }}
docker-compose up -d --build
docker system prune -af

0 comments on commit 9c93b28

Please sign in to comment.