-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (68 loc) · 1.8 KB
/
python-publish.yml
File metadata and controls
85 lines (68 loc) · 1.8 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Publish Python package
on:
push:
tags:
- "v*"
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build Python package
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build tools
run: python -m pip install --upgrade pip build twine
- name: Build distributions
run: python -m build Python/rd2d
- name: Check distributions
run: python -m twine check Python/rd2d/dist/*
- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: python-dist
path: Python/rd2d/dist/*
if-no-files-found: error
test:
name: Test Python package
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install package
run: python -m pip install -e "Python/rd2d[test,plots]"
- name: Run tests
working-directory: Python/rd2d
run: python -m pytest
publish:
name: Publish to PyPI
needs: [build, test]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/rd2d/
permissions:
contents: read
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v8
with:
name: python-dist
path: dist
- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist