Repository navigation
47 lines (44 loc) · 1.86 KB
/
Copy pathrelease-gallery-python.yml
File metadata and controls
47 lines (44 loc) · 1.86 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
# Publish the visualci-gallery Python package (clients/gallery/python) to PyPI with trusted publishing: PyPI trusts this
# workflow through GitHub's OIDC token, so no API token is stored anywhere (the pending publisher is in Nathan's Tasks
# sc-9327). Runs for a gallery-python-v* tag (matching the version in pyproject.toml) or by hand. The package carries
# the JS library's ES5 build and stylesheet (bin/assets).
name: Release gallery Python package
on:
push:
tags: ["gallery-python-v*"]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
package_json_file: clients/gallery/package.json
- uses: actions/setup-node@v4
with:
node-version: "24"
- run: pnpm install --frozen-lockfile && pnpm --filter visualci-gallery build
working-directory: clients/gallery
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: The tag matches the package's version
if: startsWith(github.ref, 'refs/tags/gallery-python-v')
working-directory: clients/gallery/python
run: |
version=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
test "gallery-python-v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME, package $version"; exit 1; }
- run: python -W error -m unittest discover -s tests
working-directory: clients/gallery/python
env:
PYTHONPATH: src
- run: bin/assets && python -m pip install --quiet build && python -m build
working-directory: clients/gallery/python
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: clients/gallery/python/dist