Skip to content

Commit e8cf982

Browse files
committed
[ci] Added GitHub workflow for publishing PyPI packages
1 parent 6898807 commit e8cf982

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

.github/workflows/pypi.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish Python Package to Pypi.org
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
id-token: write
9+
10+
jobs:
11+
pypi-publish:
12+
name: Release Python Package on Pypi.org
13+
runs-on: ubuntu-latest
14+
environment:
15+
name: pypi
16+
url: https://pypi.org/p/djangorestframework-gis
17+
permissions:
18+
id-token: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
- name: Install dependencies
26+
run: |
27+
pip install -U pip
28+
pip install build
29+
- name: Build package
30+
run: python -m build
31+
- name: Publish package distributions to PyPI
32+
uses: pypa/[email protected]

setup.py

-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/usr/bin/env python
22
import os
3-
import sys
43

54
from setuptools import find_packages, setup
65

76
from rest_framework_gis import get_version
87

9-
if sys.argv[-1] == 'publish':
10-
os.system("python setup.py sdist bdist_wheel")
11-
os.system("twine upload -s dist/*")
12-
os.system("rm -rf dist build")
13-
args = {'version': get_version()}
14-
print("You probably want to also tag the version now:")
15-
print(" git tag -a %(version)s -m 'version %(version)s'" % args)
16-
print(" git push --tags")
17-
sys.exit()
18-
198
here = os.path.abspath(os.path.dirname(__file__))
209

2110
# Get the long description from the README file

0 commit comments

Comments
 (0)