-
Notifications
You must be signed in to change notification settings - Fork 58
49 lines (44 loc) · 1.23 KB
/
publish-tag-to-pypi.yaml
File metadata and controls
49 lines (44 loc) · 1.23 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
name: Publish Tag to PyPI
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install build tool
run: python3 -m pip install build --user --upgrade
- name: Build wheel and source distribution
run: python3 -m build
- name: Upload distributables as artifact
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment:
name: pypi
steps:
- name: Download distributables
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Install Twine
run: python3 -m pip install --user --upgrade twine packaging
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 -m twine upload dist/*