-
Notifications
You must be signed in to change notification settings - Fork 28
57 lines (48 loc) · 1.69 KB
/
release-python.yml
File metadata and controls
57 lines (48 loc) · 1.69 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
name: Release Python Package
on:
workflow_dispatch:
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Get version from pyproject.toml
id: get_version
working-directory: pctx-py
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Releasing version: $VERSION"
- name: Create git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "pctx-py-v${{ steps.get_version.outputs.version }}"
git push origin "pctx-py-v${{ steps.get_version.outputs.version }}"
- name: Build package
run: ./scripts/build-python.sh
- name: Publish to PyPI
working-directory: pctx-py
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: uv publish --token $UV_PUBLISH_TOKEN
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "pctx-py-v${{ steps.get_version.outputs.version }}" \
--title "pctx-py v${{ steps.get_version.outputs.version }}" \
--notes "Release of pctx-client Python package version ${{ steps.get_version.outputs.version }}" \
pctx-py/dist/*