-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 2.13 KB
/
Copy pathpython-package-publish.yml
File metadata and controls
71 lines (59 loc) · 2.13 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: Python Package Publish
on:
workflow_dispatch:
inputs:
publish:
description: "Publish Python package to PyPI"
required: true
default: "false"
type: choice
options:
- "false"
- "true"
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
jobs:
python-package:
name: Build and publish Python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Test
run: uv run pytest
- name: Build Python wheel and sdist
run: uv build
- name: Build devspec framework payload zip
run: |
zip -r "dist/devspec-framework-payload-${GITHUB_REF_NAME:-local}.zip" \
AGENTS.md GEMINI.md README.md devspec \
.github/prompts .github/agents .github/skills \
.claude .cursor .gemini .agents packaging/devspec-profiles.json
find dist -maxdepth 1 -type f ! -name devspec-python-package-checksums.txt -print0 \
| sort -z \
| xargs -0 sha256sum > dist/devspec-python-package-checksums.txt
- name: Upload Python package release artifacts
uses: actions/upload-artifact@v7
with:
name: devspec-python-package-dist
path: dist/*
- name: Publish Python package to TestPyPI
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'false'
run: uv publish --publish-url https://test.pypi.org/legacy/ dist/*.tar.gz dist/*.whl
- name: Publish Python package to PyPI
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
run: uv publish dist/*.tar.gz dist/*.whl
- name: Attach Python package release artifacts
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v3
with:
files: dist/*