deploy 0.94 #14
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: Build And Deploy | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
deploy: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ubuntu | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
sudo sh -c 'truncate -s 0 /var/lib/docker/containers/*/*-json.log' | |
cd ~/${{ secrets.REPOSITORY_NAME }}-prod | |
git checkout main | |
git stash push || true | |
git pull | |
git stash pop || true | |
sudo echo "${{ secrets.DOT_ENT_DJANGO }}" > .env-django | |
sudo echo "${{ secrets.DOT_ENT_MYSQL }}" > .env-mysql | |
sudo echo "${{ secrets.DOT_ENT_NEO4J }}" > .env-neo4j | |
sudo docker rm -f ${{ secrets.REPOSITORY_NAME }} || true | |
sudo docker-compose -f docker-compose.yml -f docker-compose-prod.yml up -d --build |