-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (78 loc) · 2.42 KB
/
Copy pathpublish-python.yml
File metadata and controls
83 lines (78 loc) · 2.42 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
name: Publish Python Package
on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: Existing Python release tag to validate, for example v0.1.1
required: true
type: string
permissions:
contents: read
concurrency:
group: publish-python-${{ github.event.release.tag_name || inputs.release_tag }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/python
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name || inputs.release_tag }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: packages/python/package-lock.json
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: packages/python/pyproject.toml
- run: npm ci
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[all,test,dev]"
- name: Validate tag and package metadata
run: python scripts/validate_publish_release.py --release-tag "${RELEASE_TAG}"
env:
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }}
- run: npm run build
- run: npm run typecheck
- run: npm test
- run: npm run build:python-assets
- run: npm run verify:python-assets
- run: python -m pytest
- name: Build and inspect distributions
run: |
python -m build --outdir python-dist
python -m twine check python-dist/*
python scripts/check_wheel_contents.py python-dist/*.whl
python scripts/verify_wheel_installs.py python-dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: python-dist
path: packages/python/python-dist
if-no-files-found: error
publish:
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
needs: build
environment: pypi
permissions:
id-token: write
contents: read
steps:
- uses: actions/download-artifact@v4
with:
name: python-dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist