Skip to content

Commit f802b3e

Browse files
committed
CI: Add release workflow
1 parent cf4354c commit f802b3e

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/release.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_pypi:
7+
description: 'Upload to Test PyPI instead of PyPI'
8+
required: false
9+
default: false
10+
type: boolean
11+
release:
12+
types: [published]
13+
14+
jobs:
15+
build-and-publish:
16+
runs-on: ubuntu-latest
17+
environment: release
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v5
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.13'
27+
28+
- name: Install uv
29+
run: |
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
31+
- name: Install build dependencies
32+
run: |
33+
uv pip install --python ${Python_ROOT_DIR} build twine
34+
35+
- name: Build package
36+
run: python -m build
37+
38+
- name: Check package
39+
run: python -m twine check dist/*
40+
41+
- name: Upload to Test PyPI
42+
if: ${{ github.event.inputs.test_pypi == 'true' }}
43+
uses: pypa/gh-action-pypi-publish@release/v1
44+
with:
45+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
46+
repository-url: https://test.pypi.org/legacy/
47+
verbose: true
48+
49+
- name: Upload to PyPI
50+
if: ${{ github.event.inputs.test_pypi != 'true' }}
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
password: ${{ secrets.PYPI_API_TOKEN }}
54+
verbose: true

0 commit comments

Comments
 (0)