-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.33 KB
/
publish.yml
File metadata and controls
57 lines (47 loc) · 1.33 KB
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
49
50
51
52
53
54
55
56
name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:
inputs:
pypi_target:
description: 'PyPI target (pypi or testpypi)'
default: 'testpypi'
type: choice
options:
- pypi
- testpypi
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install build deps
run: |
pip install build twine
- name: Lint with ruff
run: pip install ruff && ruff check src/ --target-version py310
- name: Build package
run: |
python -m build
- name: Publish to PyPI
if: ${{ inputs.pypi_target != 'testpypi' || github.event_name == 'release' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/* --verbose
- name: Publish to TestPyPI
if: ${{ inputs.pypi_target == 'testpypi' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
twine upload --repository testpypi dist/* --verbose