Skip to content

Commit 4945ab1

Browse files
committed
add pypi publish ci
1 parent 656505e commit 4945ab1

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v[0-9]+.[0-9]+.[0-9]+'
5+
6+
7+
jobs:
8+
pypi-publish:
9+
name: Upload release to PyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/wherobots-python-dbapi-driver
14+
permissions:
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.9
21+
- name: Install Poetry
22+
uses: snok/install-poetry@v1
23+
- name: Compare tag and project version
24+
run: |
25+
if [ "v$(poetry version | cut -d' ' -f2)" != "${{ github.ref_name }}" ]; then echo "Version mismatch"; exit 1; fi
26+
- name: Poetry Build
27+
run: |
28+
poetry build
29+
- name: Publish package distributions to PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Contributor Guidance
2+
3+
## Publish package to PyPI
4+
When we are ready to release a new version `vx.y.z`, one of the maintainers should:
5+
1. Execute `poetry version {minor,patch}` to update the project version
6+
2. Create a new tag `git tag vx.y.z`, if the tag doesn't match with the project version, step 4 validation will fail
7+
3. push the tag to the repo `git push origin vx.y.z`
8+
4. There will be a GitHub Action triggered automatically, which will build and publish to PyPI

0 commit comments

Comments
 (0)