Update ci.yml #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 API | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🔍 Checkout do repositorio | |
uses: actions/checkout@v3 | |
- name: 🚀 Deploy to vps | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSHKEY }} | |
ARGS: "-rlgoDzvc -i --delete" | |
REMOTE_HOST: ${{ secrets.HOST }} | |
REMOTE_USER: ${{ secrets.USERNAME }} | |
TARGET: ${{ secrets.TARGET }} | |
EXCLUDE: ".env, /test/, .gitignore" | |
SCRIPT_AFTER: | | |
# Criar o ambiente virtual | |
python3.11 -m venv /var/www/blog/.venv | |
# Ativar o ambiente virtual | |
source /var/www/blog/.venv/bin/activate | |
# Atualizar o pip e instalar as dependências | |
python3.11 -m pip install --upgrade pip | |
pip install -r /var/www/blog/requirements.txt | |
# Desativar o ambiente virtual | |
deactivate | |
sudo service apache2 restart |