-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 2.19 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (76 loc) · 2.19 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Verify tag matches pyproject version
run: |
tag="${GITHUB_REF_NAME#v}"
pkg=$(uv run python -c "import tomllib,pathlib;print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
echo "tag=$tag pyproject=$pkg"
if [ "$tag" != "$pkg" ]; then
echo "::error::git tag ($tag) does not match pyproject.toml version ($pkg)"
exit 1
fi
- name: Build sdist + wheel
run: uv build
- name: Check distribution metadata
run: |
uv tool run --from twine twine check dist/*
- name: Upload dist artifact
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyyapi
permissions:
id-token: write
steps:
- name: Download dist artifact
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Publish to PyPI via Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: GitHub Release notes
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate Conventional-Commits-grouped notes
run: |
bash .github/scripts/generate-release-notes.sh > /tmp/release-notes.md
echo "--- generated notes ---"
cat /tmp/release-notes.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes-file /tmp/release-notes.md \
--verify-tag