-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (81 loc) · 2.87 KB
/
python-publish.yml
File metadata and controls
82 lines (81 loc) · 2.87 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
name: Build & Publish anygrad to PyPI
on:
release:
types: [created]
workflow_dispatch:
jobs:
build-windows:
name: Build on Windows
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: [x86, x64]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.architecture }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Upgrade pip, setuptools, wheel, and install build
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build distributions on Windows
run: python -m build
- name: List generated files on Windows
run: dir dist
- name: Upload Windows Build Artifacts
uses: actions/upload-artifact@v4
with:
name: windows-dist-${{ matrix.python-version }}-${{ matrix.architecture }}
path: dist/*
build-macos:
name: Build on macOS
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip, setuptools, wheel, and install build
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build distributions on macOS
run: python -m build
- name: List generated files on macOS
run: ls -lh dist/
- name: Upload macOS Build Artifacts
uses: actions/upload-artifact@v4
with:
name: macos-dist-${{ matrix.python-version }}
path: dist/*
publish:
name: Combine and Publish Distributions to PyPI
runs-on: macos-latest
needs: [build-windows, build-macos]
steps:
- name: Download All Build Artifacts
uses: actions/download-artifact@v4
with:
path: dist/
- name: List combined distribution files
run: ls -lh dist/
- name: Upgrade pip, setuptools, wheel and install twine
run: python -m pip install --upgrade pip setuptools wheel twine
- name: Check distributions before upload
run: |
files=$(find dist/ -type f \( -name "*.whl" -o -name "*.tar.gz" \))
python -m twine check $files
- name: Publish to PyPI
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
files=$(find dist/ -type f \( -name "*.whl" -o -name "*.tar.gz" \))
python -m twine upload --skip-existing $files --username __token__ --password "$PYPI_API_TOKEN"