-
Notifications
You must be signed in to change notification settings - Fork 68
48 lines (41 loc) · 1.42 KB
/
pypi_release.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
46
47
48
name: Publish release to PyPI
on:
push:
branches:
- main
release:
types:
- created
jobs:
build-and-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install flit
run: python -m pip install flit
- name: Build a binary wheel and a source tarball
run: flit build
- name: Publish distribution to Test PyPI
# We’d like to always publish to Test PyPI in order to spot errors with
# the publish step, however, this would require a new version each time
# we make a (test) release. For now, use the same logic for test as for
# the real release.
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'release'
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
FLIT_INDEX_URL: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
# Only publish to main PyPI when it is a tagged release
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'release'
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
FLIT_INDEX_URL: https://upload.pypi.org/legacy/