-
Notifications
You must be signed in to change notification settings - Fork 15
39 lines (35 loc) · 1.22 KB
/
publish-to-pypi.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
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
release:
types: [created]
jobs:
build-n-publish:
if: endsWith(github.ref, '-py')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pip
run: python3 -m pip install --upgrade pip
- name: Install build & twine
run: pip install build twine
- name: Build a binary wheel and a source tarball
working-directory: django
run: python3 -m build
- name: Publish distribution 📦 to Test PyPI
env:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
working-directory: django
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Publish distribution 📦 to PyPI
env:
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
working-directory: django
run: twine upload dist/*