Skip to content

Commit f742839

Browse files
committed
ci: deploy to PyPI workflow
1 parent 74045c8 commit f742839

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- uses: actions/setup-python@v3
14+
with:
15+
python-version: 3.11
16+
17+
- name: Update version in pyproject.toml from current git tag
18+
run: >-
19+
sed -i "s/0\\.0\\.0\\.dev0/${GITHUB_REF/refs\/tags\/v/}/g" pyproject.toml
20+
21+
- run: |
22+
pip install build
23+
python -m build
24+
25+
- uses: actions/upload-artifact@v3
26+
with:
27+
path: ./dist
28+
29+
deploy:
30+
needs: ['build']
31+
environment: 'pypi'
32+
33+
name: upload release to PyPI
34+
runs-on: ubuntu-latest
35+
permissions:
36+
# IMPORTANT: this permission is mandatory for trusted publishing
37+
id-token: write
38+
steps:
39+
- uses: actions/download-artifact@v3
40+
41+
- name: Publish package distributions to PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
packages_dir: artifact/

0 commit comments

Comments
 (0)