Repository navigation
69 lines (57 loc) · 1.68 KB
/
Copy pathrelease-python.yml
File metadata and controls
69 lines (57 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
64
65
66
67
68
69
name: Release Python
on:
release:
types:
- published
jobs:
build:
if: startsWith(github.event.release.tag_name, 'python-v')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up mise
uses: jdx/mise-action@v4
- name: Verify release tag matches package version
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
package_version="$(uv version --short --package tossinvest-openapi)"
expected_tag="python-v${package_version}"
if [ "$RELEASE_TAG" != "$expected_tag" ]; then
echo "Release tag ($RELEASE_TAG) must match Python package version ($expected_tag)."
exit 1
fi
- name: Install dependencies
run: pnpm install && uv sync --locked --all-packages
- name: Run checks
run: mise run check
- name: Build package
run: rm -rf dist && uv build --package tossinvest-openapi
- name: Upload package artifact
uses: actions/upload-artifact@v7
with:
name: python-dist
path: dist/*
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: read
id-token: write
steps:
- name: Set up uv
uses: astral-sh/setup-uv@v8.2.0
with:
version: "0.9.17"
- name: Download package artifact
uses: actions/download-artifact@v7
with:
name: python-dist
path: dist
- name: Publish package
run: uv publish --trusted-publishing always dist/*