-
Notifications
You must be signed in to change notification settings - Fork 19
176 lines (149 loc) · 5.24 KB
/
Copy pathrelease.yml
File metadata and controls
176 lines (149 loc) · 5.24 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
PYTHON_VERSION: "3.12"
UV_VERSION: "0.10.9"
UV_NO_MANAGED_PYTHON: "1"
NO_MKDOCS_2_WARNING: "1"
jobs:
compatibility:
name: Release Compatibility
uses: ./.github/workflows/compatibility.yml
permissions:
contents: read
provider-contracts:
name: Verify Provider Contracts
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Require successful live contracts for this commit
env:
GH_TOKEN: ${{ github.token }}
RELEASE_COMMIT: ${{ github.sha }}
run: >-
python scripts/verify_provider_contract_runs.py
--repository "${{ github.repository }}" --commit "$RELEASE_COMMIT"
quality:
name: Release Quality and Security
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Install Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install the complete release environment
run: uv sync --locked --all-extras --all-groups
- name: Check source quality
run: |
uv run ruff check src/ tests/ scripts/
uv run ruff format --check src/ tests/ scripts/
uv run ty check
- name: Build documentation strictly
run: uv run mkdocs build --strict
- name: Audit the complete locked environment
run: |
uv export --locked --all-extras --all-groups --no-emit-project --no-hashes --output-file requirements-audit.txt
uv run pip-audit --requirement requirements-audit.txt
build:
name: Build Validated Artifacts
runs-on: ubuntu-latest
needs: [compatibility, provider-contracts, quality]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Install Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: ${{ env.UV_VERSION }}
enable-cache: false
- name: Install verification tooling
run: uv sync --locked --dev
- name: Build distributions
run: uv build --out-dir dist/packages
- name: Check package metadata rendering
run: uv run twine check dist/packages/*
- name: Validate tag, metadata, installs, and checksums
env:
RELEASE_TAG: ${{ github.ref_name }}
run: >-
uv run python scripts/verify_distribution.py --dist-dir dist/packages
--expected-tag "$RELEASE_TAG" --write-checksums --checksum-file dist/SHA256SUMS
- name: Upload validated distributions
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: validated-dist
path: dist/
if-no-files-found: error
retention-days: 14
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build
environment: pypi
permissions:
contents: read
id-token: write # Required for PyPI trusted publishing.
steps:
- name: Download validated distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: validated-dist
path: dist/
- name: Verify artifact checksums
working-directory: dist/packages
run: sha256sum --check ../SHA256SUMS
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
packages-dir: dist/packages/
github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: publish
permissions:
contents: write # Required to create the GitHub release.
steps:
- name: Download validated distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: validated-dist
path: dist/
- name: Create GitHub release with validated distributions
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
tag="$RELEASE_TAG"
args=("$tag" dist/packages/* dist/SHA256SUMS --generate-notes)
if [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(a|b|rc)[0-9]+$ ]]; then
args+=(--prerelease)
fi
gh release create "${args[@]}"