Repository navigation
50 lines (47 loc) · 2.26 KB
/
Copy pathrelease-gallery-python.yml
File metadata and controls
50 lines (47 loc) · 2.26 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
# 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@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
with:
package_json_file: clients/gallery/package.json
# setup-node v4 caches only when `cache:` is set, and this publishing job sets none.
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with: # zizmor: ignore[cache-poisoning]
node-version: "24"
- run: pnpm install --frozen-lockfile && pnpm --filter visualci-gallery build
working-directory: clients/gallery
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
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@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
packages-dir: clients/gallery/python/dist