-
Notifications
You must be signed in to change notification settings - Fork 42
45 lines (43 loc) · 1.2 KB
/
python-publish.yml
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
name: Upload Python Package
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python '3.8'
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Install Dependencies
run: |
python -m pip install --upgrade -r requirements.txt
- name: Build Distribution
run: |
python setup.py sdist
- name: Run Tests
run: |
python manage.py test
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Install Twine
run: |
python -m pip install --upgrade twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_PYPI_URL: ${{ secrets.PYPI_URL }}
run: |
python setup.py sdist
twine upload --repository-url $TWINE_PYPI_URL -u $TWINE_USERNAME -p $TWINE_PASSWORD dist/*