Repository navigation
58 lines (52 loc) · 1.51 KB
/
Copy pathpython-publish.yml
File metadata and controls
58 lines (52 loc) · 1.51 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
54
55
56
57
58
# This workflow builds and publishes the package to PyPI when a GitHub
# release is published. It uses PyPI's Trusted Publishing (OIDC), so no
# API token secret is required - the "IMProToo" project on PyPI must have
# this repo/workflow registered as a trusted publisher
# (https://docs.pypi.org/trusted-publishers/).
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install IMProToo with test dependencies
run: |
python -m pip install --upgrade pip
pip install ".[test]"
- name: Run tests
run: pytest tests/ -v
deploy:
needs: test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/IMProToo/
permissions:
id-token: write # required for PyPI Trusted Publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # setuptools_scm needs the full history and tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1