-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 1.67 KB
/
python.yml
File metadata and controls
71 lines (60 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build & Check
on:
push:
branches:
- '**'
paths:
- 'bot/**'
- '.github/workflows/python.yml'
- 'alembic/**'
- 'requirements.txt'
- 'requirements-dev.txt'
tags:
- 'v*'
pull_request:
branches: [ 'master' ]
paths:
- 'bot/**'
- '.github/workflows/python.yml'
- 'alembic/**'
- 'requirements.txt'
- 'requirements-dev.txt'
jobs:
Python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
- name: Install dependencies
run: |
pip install -U pip wheel setuptools --quiet
pip install -r requirements-dev.txt
- name: Lint with Black, Pylint, Flake8, and Bandit
run: make lint
Deploy:
runs-on: ubuntu-latest
needs: Python
steps:
- uses: actions/checkout@v3
- name: Set Deployment
run: |
if [ "$REF" == "true" ]; then
echo "DEPLOYMENT=--app ccc-bot" >> $GITHUB_ENV
fi
env:
REF: ${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Assign variable
id: secret
run: echo '::set-output name=secret::${{secrets.FLY_API_TOKEN}}'
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --detach --remote-only ${{ env.DEPLOYMENT }}
if: steps.secret.outputs.secret
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}