-
Notifications
You must be signed in to change notification settings - Fork 36
96 lines (80 loc) · 2.28 KB
/
release.yml
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
86
87
88
89
90
91
92
93
94
95
96
name: Build sdist and wheels
on:
workflow_dispatch:
inputs:
upload_to_pypi:
description: "Upload to PyPI? Y/[N]"
default: "N"
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
# Python 3.8 is the oldest version supported by build
python-version: "3.8"
- name: Install pip build
run: |
python -m pip install "build"
- name: Build sdist tarball
shell: bash
run: |
python -m build --sdist .
- uses: actions/upload-artifact@v4
with:
name: sdist
path: |
dist/*.tar.gz
if-no-files-found: error
build_generic_wheel:
name: Build generic wheel (without speedups)
runs-on: ubuntu-20.04
env:
# Build a wheel without speedups that can run on pure Python
GENSHI_BUILD_SPEEDUP: 0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
# Python 3.8 is the oldest version supported by build
python-version: "3.8"
- name: Install pip build
run: |
python -m pip install "build"
- name: Build wheel
shell: bash
run: |
python -m build --wheel .
- uses: actions/upload-artifact@v4
with:
name: wheels
path: |
dist/*.whl
if-no-files-found: error
deploy:
name: "Upload to PyPI if selected"
if: github.event.inputs.upload_to_pypi == 'Y'
needs: [build_sdist, build_generic_wheel]
runs-on: ubuntu-latest
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: 1
TWINE_REPOSITORY: pypi
steps:
- name: Download build artifacts to local runner
uses: actions/download-artifact@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.10"
- name: Install twine
run: |
python -m pip install "twine"
- name: Upload sdist and wheel to PyPI
run: |
python -m twine upload --verbose wheels/*.whl sdist/*.tar.gz