-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (95 loc) · 2.7 KB
/
Copy pathpublish.yml
File metadata and controls
113 lines (95 loc) · 2.7 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Publish to PyPI
on:
push:
tags:
- 'v*' # Trigger on version tags like v0.1.0, v1.0.0, etc.
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (skip actual upload)'
required: false
default: false
type: boolean
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
cibw_archs: "x86_64"
# macOS Intel (x86_64)
- os: macos-15-intel
cibw_archs: "x86_64"
# macOS Apple Silicon (arm64)
- os: macos-15
cibw_archs: "arm64"
steps:
- uses: actions/checkout@v5
- name: Build wheels
uses: pypa/cibuildwheel@v2.22
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
- name: Upload wheels
uses: actions/upload-artifact@v5
with:
name: wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl
retention-days: 1
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist
run: python -m build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
retention-days: 1
publish:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/kh57/
permissions:
id-token: write # IMPORTANT: Needed for Trusted Publisher (OIDC)
contents: read
steps:
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
path: dist
merge-multiple: true
- name: List distributions
run: |
ls -lh dist/
echo "Total wheels: $(ls -1 dist/*.whl 2>/dev/null | wc -l)"
echo "Total sdist: $(ls -1 dist/*.tar.gz 2>/dev/null | wc -l)"
- name: Publish to PyPI
if: ${{ !inputs.dry_run }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
- name: Dry run mode
if: ${{ inputs.dry_run }}
run: |
echo "DRY RUN MODE - Skipping PyPI upload"
echo "Wheels that would be uploaded:"
ls -lh dist/