forked from peteshadbolt/permanent
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (88 loc) · 2.85 KB
/
pypi-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
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: Package to PyPi
#on:
# release:
# types: [published]
on: workflow_dispatch
env:
WHL_HOUSE: wheelhouse
COMPILED_ARTS: compiled-artifacts
permissions:
contents: read
jobs:
build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: make sdists
run: |
mkdir -p $WHL_HOUSE
python -m pip install build
python -m build --sdist --outdir $WHL_HOUSE .
ls ./$WHL_HOUSE # Listing the contents of ./$WHL_HOUSE for a sanity check
- name: Artifactize sdist
uses: actions/upload-artifact@v4
with:
name: ${{ env.COMPILED_ARTS }}
path: ${{ env.WHL_HOUSE }}
build-compiled-python-wheels:
# The manylinyux action (the following one) runs everything as root. So it
# is not predicatble how this interacts with other actions (e.g., it might
# create a directory accessible only for root so that subsequent actions
# cannot use it).
# Hence, it is very convenient to thave this action in a separate job
# and publish the outcome as artifacts.
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build permanentbis wheels
uses: pypa/cibuildwheel@v2.20.0
env:
# We skip old versions of cPython, and all PyPy
# because we're not sure the C extension works on PyPy
CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-* pp*"
CIBW_BUILD_FRONTEND: "build"
with:
output-dir: '${{ env.WHL_HOUSE }}'
- name: Artifactize compiled-python wheels
uses: actions/upload-artifact@v4
with:
name: ${{ env.COMPILED_ARTS }}-${{ matrix.os }}
path: ${{ env.WHL_HOUSE }}
pypi-update:
needs: [build-compiled-python-wheels, build-sdist]
name: Publish to PyPI
environment: pypi-upload
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: ${{ env.WHL_HOUSE }}
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ env.WHL_HOUSE }}
- name: Display all artifacts
run: ls -R
working-directory: ${{ env.WHL_HOUSE }}
#- name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# packages-dir: ${{ env.WHL_HOUSE }}/
# verbose: true