-
Notifications
You must be signed in to change notification settings - Fork 42
45 lines (36 loc) · 1.32 KB
/
release-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
40
41
42
43
44
45
name: PyPI Release
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
push:
branches: [main]
release:
types: [published]
# based on https://github.com/pypa/gh-action-pypi-publish
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: pip install -U build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
# We do this, since failures on test.pypi aren't that bad
# - name: Publish to Test PyPI
# if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
# uses: pypa/[email protected]
# with:
# user: __token__
# password: ${{ secrets.test_pypi_password }}
# repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}