-
Notifications
You must be signed in to change notification settings - Fork 367
80 lines (70 loc) · 2.31 KB
/
Copy pathpython-publish.yml
File metadata and controls
80 lines (70 loc) · 2.31 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
70
71
72
73
74
75
76
77
78
79
80
name: Publish Python package
on:
push:
branches: [main]
paths:
- 'client/packages/version/src/version.ts'
jobs:
build:
name: Build wheel
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: latest
enable-cache: true
cache-dependency-glob: client/packages/python/pyproject.toml
- name: Sync deps (pinned to Python 3.10, the minimum supported)
working-directory: client/packages/python
run: uv sync --python 3.10
- name: Verify _sync/ is up to date with _async/
working-directory: client/packages/python
run: |
make unasync
# --porcelain catches both modifications and new files (which a
# plain `git diff --exit-code` would miss for untracked paths).
if [ -n "$(git status --porcelain src/instantdb/_sync/)" ]; then
echo "Generated src/instantdb/_sync/ is stale."
echo ""
echo "Run 'make unasync' locally and commit the regenerated files."
echo ""
echo "--- git status ---"
git status --short src/instantdb/_sync/
echo ""
echo "--- git diff (tracked changes) ---"
git --no-pager diff src/instantdb/_sync/
exit 1
fi
- name: Run check (ruff + mypy + pytest)
working-directory: client/packages/python
run: make check
# Wheel only; see pyproject.toml for the rationale.
- name: Build
working-directory: client/packages/python
run: uv build --wheel
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: client/packages/python/dist/
publish:
name: Publish to PyPI via OIDC
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/instantdb
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1