-
Notifications
You must be signed in to change notification settings - Fork 551
154 lines (147 loc) · 5.42 KB
/
Copy pathrelease.yml
File metadata and controls
154 lines (147 loc) · 5.42 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Release
on:
push:
branches:
- main
- master
release:
types: [published]
permissions:
contents: read
jobs:
release-drafter:
if: github.event_name == 'push'
name: Draft Release Notes
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Draft Release
uses: release-drafter/release-drafter@34d80673e067bdc0c24568d3af899c216adcfaa9 # v7.7.0
with:
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-to-testpypi:
# Temporarily disabled: pypa/gh-action-pypi-publish release/v1 now defaults
# to Trusted Publishing (OIDC) and ignores the deprecated `password` input,
# so every push fails with "OpenID Connect token retrieval failed" because
# this job has no `id-token: write` permission. Re-enable once TestPyPI
# Trusted Publishing is wired (mirrors the PyPI setup below).
if: false
name: Build and Publish to TestPyPI
runs-on: ubuntu-latest
# OIDC for Trusted Publishing (now set up on TestPyPI too); the previous
# token + password fields are dropped because the pypa action prefers TP
# whenever it can fetch an OIDC token.
permissions:
id-token: write
steps:
- name: Check out the repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: false
- name: Build package (pure Python)
run: uv build --sdist --wheel
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
with:
repository_url: https://test.pypi.org/legacy/
skip-existing: true
build_wheels:
if: github.event_name == 'release' && github.event.action == 'published'
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: x86_64
runs-on: ubuntu-latest
- os: linux
arch: aarch64
runs-on: ubuntu-24.04-arm
- os: windows
arch: AMD64 # cibuildwheel 3.x renamed amd64 -> AMD64 on Windows
runs-on: windows-latest
- os: macos
arch: x86_64
runs-on: macos-15-intel
- os: macos
arch: arm64
runs-on: macos-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
env:
INVOICE2DATA_COMPILE_MYPYC: "1"
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
build_sdist:
if: github.event_name == 'release' && github.event.action == 'published'
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: false
- name: Build sdist
run: uv build --sdist --out-dir dist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: cibw-sdist
path: dist/*.tar.gz
publish_release:
if: github.event_name == 'release' && github.event.action == 'published'
name: Sign and Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/invoice2data
permissions:
id-token: write
contents: write
attestations: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: dist
merge-multiple: true
- name: Generate build provenance attestations
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4
with:
subject-path: "dist/*.whl, dist/*.tar.gz"
- name: Sign the dists with Sigstore + attach to GitHub Release
# `release-signing-artifacts: true` (default in v3) uploads both the
# signed inputs (.whl, .tar.gz) and their .sigstore.json sidecars to
# the GitHub Release that triggered the run. A previous `gh release
# upload ./dist/*` step that ran after this one was therefore
# redundant and failed with "asset under the same name already exists"
# -- removed.
uses: sigstore/gh-action-sigstore-python@790bc6befb9d733738f18d8f895854b453640ec9 # v3.5.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Remove sigstore files before publishing to PyPI
run: rm -f dist/*.sigstore dist/*.sigstore.json
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1