Spaces:
Running
Running
name: Deploy to EC2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install SSH Client | |
run: sudo apt-get install -y openssh-client | |
- name: Set up SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: SSH Command | |
run: | | |
ssh -o StrictHostKeyChecking=no -i /tmp/deploy-key.pem [email protected] 'cd infinity_talks/ && git pull https://het-vaghasia:${{ secrets.GIT_TOKEN }}@github.com/hetvaghasia39/infinity_talks.git' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl stop daphne gunicorn; cd infinity_talks/; source .venv/bin/activate; pip install -r requirements.txt; ./manage.py migrate;' | |
ssh -o StrictHostKeyChecking=no -i /tmp/deploy-key.pem [email protected] 'sudo systemctl restart gunicorn' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl daemon-reload' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl restart gunicorn.socket gunicorn.service' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl restart daphne' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo nginx -t && sudo systemctl restart nginx' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl status gunicorn' | |
ssh -i /tmp/deploy-key.pem [email protected] 'sudo systemctl status daphne' |