test: CI/CD #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to AWS EC2 | |
on: | |
push: | |
branches: | |
- test/deploy-be-on-aws | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up SSH | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy to EC2 | |
env: | |
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | | |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/chit-chat-server.pem ubuntu@ec2-18-138-250-74.ap-southeast-1.compute.amazonaws.com << 'EOF' | |
cd ~/chit-chat-backend | |
git pull origin test/deploy-be-on-aws | |
docker-compose -f ~/chit-chat-backend/docker/DockerCompose/docker-compose.prod.yml down | |
docker-compose -f ~/chit-chat-backend/docker/DockerCompose/docker-compose.prod.yml build | |
docker-compose -f ~/chit-chat-backend/docker/DockerCompose/docker-compose.prod.yml up -d | |
EOF |