-
Notifications
You must be signed in to change notification settings - Fork 27
47 lines (38 loc) · 1.17 KB
/
main.yml
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
name: Publish package on pypi
on:
push:
branches: [master]
jobs:
publish-flow:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Run Poetry image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.7.1
- name: Install library
run: poetry install --no-interaction
- name: Run tests
run: poetry run pytest
# publish version only when pyproject.toml is changed in master
- name: Filter changes in pyproject
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
root:
- 'pyproject.toml'
- if: ${{ (github.ref == 'refs/heads/master') && (steps.changes.outputs.root == 'true')}}
name: Build
run: poetry build
- if: ${{ (github.ref == 'refs/heads/master') && (steps.changes.outputs.root == 'true')}}
name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1