feat: updates to code #3
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 Azure VM | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy_project: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v44.5.7 | |
with: | |
since_last_remote_commit: true | |
separator: "," | |
- name: Copy files via scp using SSH key | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.AZURE_VM_IP_ADDRESS }} | |
username: ${{ secrets.AZURE_VM_USER }} | |
key: ${{ secrets.AZURE_VM_SSH_KEY }} | |
port: ${{ secrets.AZURE_VM_PORT }} | |
source: "." | |
target: ${{ github.event.repository.name }} | |
build_project: | |
name: Build | |
needs: deploy_project | |
runs-on: ubuntu-latest | |
steps: | |
- name: Executing remote SSH commands using SSH key | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.AZURE_VM_IP_ADDRESS }} | |
username: ${{ secrets.AZURE_VM_USER }} | |
key: ${{ secrets.AZURE_VM_SSH_KEY }} | |
port: ${{ secrets.AZURE_VM_PORT }} | |
script: | | |
cd ${{ github.event.repository.name }} | |
source venv/bin/activate | |
pip install -r config/docker/requirements.txt | |
sudo supervisorctl reread | |
sudo supervisorctl update | |
sudo supervisorctl restart all |