-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 1.68 KB
/
Copy pathrelease.yml
File metadata and controls
63 lines (52 loc) · 1.68 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
name: Release
on:
push:
tags: ["v*"]
permissions: {}
jobs:
release:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/packagename
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version: "0.11.32"
- run: uv sync --locked
- name: Verify tag matches package version
run: |
tag="${GITHUB_REF_NAME#v}"
version="$(uv run python -c 'import packagename; print(packagename.__version__)')"
if [ "$tag" != "$version" ]; then
echo "tag $tag does not match package version $version" >&2
exit 1
fi
- run: uv build
- name: Attest build provenance
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
with:
subject-path: dist/*
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
with:
attestations: true
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${GITHUB_REF_NAME}" \
--repo "${GITHUB_REPOSITORY}" \
--verify-tag \
--title "${GITHUB_REF_NAME}" \
--generate-notes \
dist/*