-
-
Notifications
You must be signed in to change notification settings - Fork 646
99 lines (85 loc) · 2.66 KB
/
Copy pathpublish-python.yml
File metadata and controls
99 lines (85 loc) · 2.66 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Publish Python package
on:
release:
types: [published]
pull_request:
branches: [main]
paths:
- "python/**"
- "apps/geolibre-desktop/src/**"
- "packages/**"
- "scripts/build-embed.mjs"
- ".github/workflows/publish-python.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: publish-python-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test Python package
runs-on: ubuntu-22.04
strategy:
matrix:
# Cover the declared minimum (requires-python >= 3.11) and current
# releases so newer-only syntax can't slip in unnoticed.
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
# Tests cover the pure-Python builders and do not need the bundled web
# app, so install only the runtime/test deps and run against the sources.
- name: Install test dependencies
run: python -m pip install anywidget traitlets pytest
- name: Run tests
run: python -m pytest python/tests
env:
PYTHONPATH: python/src
publish:
name: Build wheel and publish
runs-on: ubuntu-22.04
needs: test
if: github.event_name == 'release'
environment: pypi
permissions:
contents: read
id-token: write # PyPI Trusted Publishing (OIDC)
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: "22"
cache: npm
cache-dependency-path: package-lock.json
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install frontend dependencies
run: npm ci
- name: Install build backend
run: python -m pip install build
- name: Build wheel and sdist
working-directory: python
run: python -m build
env:
# Force a fresh embed build so the published wheel always carries the
# current app bundle.
GEOLIBRE_FORCE_JS_BUILD: "1"
NODE_OPTIONS: --max-old-space-size=4096
VITE_GEE_OAUTH_CLIENT_ID: ${{ secrets.VITE_GEE_OAUTH_CLIENT_ID }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # release/v1
with:
packages-dir: python/dist