Skip to content

Commit 67dd192

Browse files
committed
add publish gh workflow
1 parent 03362db commit 67dd192

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Publish python package
3+
on:
4+
release:
5+
types: [created]
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ['3.x']
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
cache: pip
19+
cache-dependency-path: '**/pyproject.toml'
20+
- name: Install dependencies
21+
run: |
22+
pip install -e '.[test]'
23+
- name: Run tests
24+
run: |
25+
pytest
26+
publish_on_pypi:
27+
runs-on: ubuntu-latest
28+
needs: [test]
29+
environment: release
30+
permissions:
31+
id-token: write
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.x'
38+
cache: pip
39+
cache-dependency-path: '**/pyproject.toml'
40+
- name: Install dependencies
41+
run: |
42+
pip install build
43+
- name: Build
44+
run: |
45+
python -m build
46+
- name: Publish
47+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)