-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (86 loc) · 2.77 KB
/
main.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
name: Python Package Publication
on:
pull_request:
types: [closed]
branches: [master]
paths:
- '**.cpp'
- '**.hpp'
- '**.py'
- 'setup.py'
- 'setup.cfg'
- 'pyproject.toml'
jobs:
linux-build:
runs-on: ubuntu-latest
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Get version
id: get_version
run: |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
- name: Python wheels manylinux stable build
uses: RalfG/[email protected]
with:
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
- name: upload wheel
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools twine
twine upload dist/*-manylinux*.whl
continue-on-error: false
other-os-build:
runs-on: ${{ matrix.os }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Get version
id: get_version
run: |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: build wheel
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools twine
python setup.py bdist_wheel
- name: upload wheel
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
run: |
twine upload dist/*
continue-on-error: false
release-build:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
needs: [ linux-build, other-os-build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get version
id: get_version
run: |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.get_version.outputs.version }}" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${{ steps.get_version.outputs.version }}" \
--generate-notes