Skip to content

Commit adfaa39

Browse files
committed
Added workflow to publish package on PyPi
1 parent dd63bd7 commit adfaa39

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish package
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.8'
17+
architecture: 'x64'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install setuptools wheel twine
23+
24+
- name: Build source and binary distribution package
25+
run: |
26+
python setup.py sdist bdist_wheel
27+
env:
28+
PACKAGE_VERSION: ${{ github.ref }}
29+
30+
- name: Check distribution package
31+
run: |
32+
twine check dist/*
33+
34+
- name: Publish distribution package
35+
run: |
36+
twine upload dist/*
37+
env:
38+
TWINE_REPOSITORY: ${{ secrets.PYPI_REPOSITORY }}
39+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
40+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
41+
TWINE_NON_INTERACTIVE: yes

.github/workflows/main.yml renamed to .github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build-and-test
1+
name: Run linter and tests
22
on: [push, pull_request]
33

44
jobs:
@@ -79,4 +79,3 @@ jobs:
7979
run: |
8080
cd tests
8181
python manage.py test
82-

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='django-rest-passwordreset',
13-
version='1.2',
13+
version=os.getenv('PACKAGE_VERSION', '0.0.0').replace('refs/tags/', ''),
1414
packages=find_packages(),
1515
include_package_data=True,
1616
license='BSD License',

0 commit comments

Comments
 (0)