This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
80 lines (73 loc) · 2.28 KB
/
python-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
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
push:
branches:
- main
release:
types: [published]
permissions:
contents: read
jobs:
deploy-linux:
name: Build wheels for Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels for Linux
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
- name: Upload Linux wheels as artifact
uses: actions/upload-artifact@v4
with:
name: linux-wheels
path: wheelhouse/
retention-days: 1
deploy-macos:
name: Build wheels for macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels for macOS
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
- name: Upload macOS wheels as artifact
uses: actions/upload-artifact@v4
with:
name: macos-wheels
path: wheelhouse/
retention-days: 1
publish:
name: Publish wheels to PyPI
runs-on: ubuntu-latest
needs: [deploy-linux, deploy-macos]
permissions:
id-token: write # Required for PyPI trusted publishing
steps:
- name: Download Linux wheels
uses: actions/download-artifact@v4
with:
name: linux-wheels
path: linux-wheels
- name: Download macOS wheels
uses: actions/download-artifact@v4
with:
name: macos-wheels
path: macos-wheels
- name: Combine wheels into a single directory
run: |
mkdir -p wheelhouse
cp linux-wheels/*.whl wheelhouse/
cp macos-wheels/*.whl wheelhouse/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: wheelhouse/