-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) 路 1.12 KB
/
Copy pathpublish.yml
File metadata and controls
45 lines (37 loc) 路 1.12 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
name: Publish to PyPI
on:
release:
types: [published]
jobs:
publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: astral-sh/setup-uv@v5
with:
python-version-file: ".python-version"
- name: Update version from tag
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
sed -i 's/^version = ".*"/version = "'"$TAG_VERSION"'"/' pyproject.toml
echo "Version set to: $TAG_VERSION"
if git diff --quiet pyproject.toml; then
echo "Version already matches tag, no commit needed"
else
git config user.name "mesa-ci[bot]"
git config user.email "ci-bot@mesa.dev"
git add pyproject.toml
git commit -m "chore: bump version to $TAG_VERSION"
git push origin main
fi
- name: Build package
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1