Update main.yml #2
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: Auto-Deploy Flask App | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: [self-hosted] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Stop Existing Flask App | |
run: pkill -f "python app.py" || true | |
- name: Start Flask App | |
run: | | |
nohup python app.py & | |
- name: Output Deployment URL | |
run: echo "App deployed at http://85.209.135.93:5000" | tee url.txt | |
- name: Upload Deployment Summary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deployment-url | |
path: url.txt | |