Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Likhon Sheikh authored Jun 27, 2024
1 parent cea4426 commit 36b8db7
Showing 1 changed file with 44 additions and 25 deletions.
69 changes: 44 additions & 25 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
name: Deploy
name: Python application

on:
push:
branches:
- main # or any other branch you use for deployment
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]

permissions:
contents: read

jobs:
deploy:
build:

runs-on: ubuntu-latest
environment:
name: production # The name of the environment where you've configured your secrets

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8' # Ensure this matches your project's requirements

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Deploy
env:
MONGODB_URI: ${{ secrets.MONGODB_URI }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
run: |
# Run your application or deployment script here
python3 app.py
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
- name: Lint with flake8
run: |
source venv/bin/activate
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
source venv/bin/activate
pytest
- name: Deploy Python App
env:
MONGODB_URI: ${{ secrets.MONGODB_URI }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
run: |
source venv/bin/activate
python3 app.py

0 comments on commit 36b8db7

Please sign in to comment.