-
Notifications
You must be signed in to change notification settings - Fork 58
54 lines (45 loc) · 1.38 KB
/
python-publish.yml
File metadata and controls
54 lines (45 loc) · 1.38 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
name: python-publish
on:
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
if: |
(github.event_name == 'release' && startsWith(github.event.release.tag_name, 'python/')) ||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
with:
python-version: "3.11"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
make install
uv pip install build
working-directory: python
- name: Copy README.md
run: |
cp README.md python/README.md
- name: Build package
run: uv run python -m build
working-directory: python
# Sanity check
- name: Run tests
run: |
uv run pytest tests
working-directory: python
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
packages_dir: python/dist/
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}