Skip to content

Commit 5683b52

Browse files
committed
Implement build/publish actions in ci
1 parent 5581c84 commit 5683b52

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: ci
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
workflow_dispatch:
410

511
jobs:
612
pre-commit:
@@ -38,3 +44,28 @@ jobs:
3844
files: ./coverage.xml
3945
flags: unittests
4046
name: GitHub
47+
48+
build-and-publish:
49+
name: Build and publish to PyPI
50+
runs-on: ubuntu-latest
51+
needs: [pre-commit, test]
52+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
53+
environment:
54+
name: pypi
55+
url: https://pypi.org/p/registerer
56+
permissions:
57+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: Set up Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: "3.13"
64+
- name: Install Poetry
65+
uses: abatilo/actions-poetry@v2
66+
with:
67+
poetry-version: 2.2.0
68+
- name: Build package
69+
run: poetry build
70+
- name: Publish package distributions to PyPI
71+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)