-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (37 loc) · 1.04 KB
/
publish-to-pypi.yaml
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
name: Publish and Release Python Package
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for trusted publishing to PyPI
contents: write # Required for creating releases and uploading assets
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run Tests
run: poetry run pytest
- name: Build the package
if: success()
run: poetry build
- name: Publish to PyPI
if: success()
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create GitHub Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}