-
Notifications
You must be signed in to change notification settings - Fork 18
67 lines (63 loc) · 1.68 KB
/
build_and_publish.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
name: Build and publish to PyPI
on:
release:
types: [created]
pull_request:
jobs:
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist
run: python -m build --sdist --outdir dist
- uses: actions/upload-artifact@v4
with:
name: dist-source
path: dist
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14] # macos-13 for intel, macos-14 for apple silicon
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: dist
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: dist
publish-to-pypi:
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/ms2pip
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
- name: Move wheels to dist
run: |
mkdir dist/
mv dist-*/*.whl dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/