Repository navigation
71 lines (57 loc) · 1.7 KB
/
Copy pathpublish-python-sdk.yml
File metadata and controls
71 lines (57 loc) · 1.7 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
name: Publish Python SDK to PyPI
on:
workflow_dispatch:
inputs:
confirm:
description: 'Type publish-zelinqa to confirm the public PyPI release'
required: true
type: string
permissions:
contents: read
jobs:
build-and-test:
if: github.ref == 'refs/heads/main' && inputs.confirm == 'publish-zelinqa'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: uv sync --group dev --locked
- name: Lint
run: uv run ruff check python/src python/tests
- name: Type check
run: uv run mypy python/src
- name: Test
run: uv run pytest
- name: Build source and wheel distributions
run: uv build --out-dir dist
- name: Validate package metadata and README rendering
run: uv run twine check dist/*
- name: Upload immutable distributions
uses: actions/upload-artifact@v4
with:
name: zelinqa-python-distributions
path: dist/
if-no-files-found: error
retention-days: 7
publish:
needs: build-and-test
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Download distributions built by the unprivileged job
uses: actions/download-artifact@v4
with:
name: zelinqa-python-distributions
path: dist/
- name: Publish with PyPI Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/