-
Notifications
You must be signed in to change notification settings - Fork 6
105 lines (94 loc) · 3.43 KB
/
Copy pathrelease.yml
File metadata and controls
105 lines (94 loc) · 3.43 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
name: Release
# Publishes the whole version train to PyPI via trusted publishing (OIDC), with
# PEP 740 attestations and reproducible, byte-stable wheels. A tag push builds
# and publishes; a manual run defaults to a dry run that builds and verifies the
# artifacts without uploading anything.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
dry_run:
description: "Build and verify only; skip the PyPI upload."
type: boolean
default: true
permissions:
contents: read
jobs:
build:
name: build + verify artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
# Full history so the commit timestamp is available for a reproducible
# SOURCE_DATE_EPOCH.
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
python-version: "3.12"
# Reproducible builds (NFR-12): pin every archive timestamp to the tagged
# commit's authored date and fix the hash seed so the build carries no
# run-to-run entropy. hatchling honours SOURCE_DATE_EPOCH and writes wheel
# entries in a stable order, so identical inputs yield byte-identical
# wheels.
- name: Pin reproducible-build environment
run: |
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV"
echo "PYTHONHASHSEED=0" >> "$GITHUB_ENV"
# Build each published distribution explicitly so the unpublished
# workspace root never lands in dist/. Sdists ship alongside wheels.
- name: Build wheels + sdists
run: |
for pkg in \
dexpace-sdk-core \
dexpace-sdk-http-stdlib \
dexpace-sdk-http-httpx \
dexpace-sdk-http-aiohttp \
dexpace-sdk-http-requests \
dexpace-sdk-tck; do
uv build --package "$pkg" --out-dir dist
done
# NFR-14/15: every artifact carries the single, real train version -- never
# a placeholder. Blocks the upload if any wheel disagrees.
- name: Verify one version train (pyproject + uv.lock + wheels)
run: uv run --no-project python tools/check_version_train.py --wheel-dir dist
- name: List artifacts
run: ls -1 dist | sort
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-dist
path: dist/
if-no-files-found: error
publish:
name: publish to PyPI (trusted publishing)
needs: build
runs-on: ubuntu-latest
# A tag push publishes; a manual run publishes only when dry_run is turned
# off. The default manual run is a build-and-verify dry run.
if: >-
github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false')
environment:
name: pypi
url: https://pypi.org/project/dexpace-sdk-core/
permissions:
# OIDC token for PyPI trusted publishing; no long-lived API token needed.
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# PEP 740 provenance attestations, signed with the OIDC identity
# (NFR-16).
attestations: true
print-hash: true