-
Notifications
You must be signed in to change notification settings - Fork 6
43 lines (33 loc) · 1.07 KB
/
release.yaml
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
name: Release
on:
release:
types: [created]
jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Set up Python
uses: actions/setup-python@v5
- name: Check version match
run: |
# Extract version from pyproject.toml
PYPROJECT_VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml)
# Extract the release tag version
RELEASE_TAG=${{ github.ref_name }}
echo "Pyproject version: $PYPROJECT_VERSION"
echo "Release tag: $RELEASE_TAG"
# Check if they match
if [ "$PYPROJECT_VERSION" != "$RELEASE_TAG" ]; then
echo "Version mismatch! Pyproject.toml version ($PYPROJECT_VERSION) does not match the release tag ($RELEASE_TAG)."
exit 1
fi
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
uv build
uvx twine upload dist/*