added recommended vids #7
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: Deployment Workflow | |
# Trigger this workflow on pushes to the specified branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set permissions for private key | |
run: | | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > key.pem | |
chmod 600 key.pem | |
- name: Pull Recent git changes | |
run: | | |
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.USERNAME }}@${{ secrets.HOST }} 'cd aacharya.client && git pull' | |
- name: Set Django ENV | |
run: | | |
echo "${{ secrets.CLIENT_SECRETS }}" > .env | |
scp -i key.pem $(pwd)/.env ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/home/ubuntu/aacharya.client/.env | |
- name: Stop running container | |
run: | | |
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.USERNAME }}@${{ secrets.HOST }} 'docker compose -f "/home/ubuntu/aacharya.client/docker-compose.yml" down' | |
- name: Run new container | |
run: | | |
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.USERNAME }}@${{ secrets.HOST }} 'docker compose -f "/home/ubuntu/aacharya.client/docker-compose.yml" up -d --build' |