Repository navigation
53 lines (53 loc) · 1.65 KB
/
Copy pathrelease.yml
File metadata and controls
53 lines (53 loc) · 1.65 KB
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
48
49
50
51
52
53
name: Check and release Python package
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
publish:
description: Publish the checked version to PyPI
type: boolean
default: false
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.10', '3.12', '3.14']
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: ${{ matrix.python }}
- run: PYTHONPATH=src python -W error::ResourceWarning -m unittest discover -s tests -v
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.12'
- run: python -m pip install build==1.6.1 twine==7.0.0
- run: python -m build
- run: python -m twine check dist/*
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: distributions
path: dist/*
publish:
if: github.event_name == 'workflow_dispatch' && inputs.publish && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086