Skip to content

Commit d83d01f

Browse files
mnriemCopilot
andcommitted
feat: add PyPI publishing workflow and readme metadata
- Add readme = "README.md" to pyproject.toml for PyPI project description - Add manual publish-pypi.yml workflow using trusted publishers (OIDC) - Update release.yml install instructions to prefer PyPI The publish workflow is manually triggered after a release, checks out the specified tag, verifies version consistency, builds with uv, and publishes using trusted publishing (no API tokens required). Prerequisites before first use: - Take ownership of the specify-cli PyPI project (#2908) - Create a 'pypi' environment in repo settings - Configure trusted publisher on PyPI for this repo/workflow Closes #2908 Co-authored-by: Copilot <[email protected]>
1 parent 6a3ee9b commit d83d01f

3 files changed

Lines changed: 78 additions & 1 deletion

File tree

‎.github/workflows/publish-pypi.yml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release tag to publish (e.g., v0.10.1)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout release tag
19+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
20+
with:
21+
ref: ${{ inputs.tag }}
22+
23+
- name: Verify tag is a release
24+
run: |
25+
TAG="${{ inputs.tag }}"
26+
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
27+
echo "Error: '$TAG' is not a valid release tag (expected vX.Y.Z)"
28+
exit 1
29+
fi
30+
31+
- name: Verify tag matches package version
32+
run: |
33+
TAG_VERSION="${{ inputs.tag }}"
34+
TAG_VERSION="${TAG_VERSION#v}"
35+
PROJECT_VERSION="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')"
36+
if [[ "$TAG_VERSION" != "$PROJECT_VERSION" ]]; then
37+
echo "Error: Tag version ($TAG_VERSION) does not match pyproject.toml version ($PROJECT_VERSION)"
38+
exit 1
39+
fi
40+
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5
43+
44+
- name: Build package
45+
run: uv build
46+
47+
- name: Upload build artifacts
48+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
49+
with:
50+
name: dist
51+
path: dist/
52+
53+
publish:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
environment: pypi
57+
permissions:
58+
id-token: write
59+
steps:
60+
- name: Download build artifacts
61+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
62+
with:
63+
name: dist
64+
path: dist/
65+
66+
- name: Install uv
67+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5
68+
69+
- name: Publish to PyPI
70+
run: uv publish --trusted-publishing always

‎.github/workflows/release.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,16 @@ jobs:
6666
## Install
6767
6868
\`\`\`bash
69-
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git@${VERSION}
69+
uv tool install specify-cli@latest
7070
specify init my-project
7171
\`\`\`
7272
73+
Or install from source:
74+
75+
\`\`\`bash
76+
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git@${VERSION}
77+
\`\`\`
78+
7379
NOTES_EOF
7480
7581
echo "## What's Changed" >> release_notes.md

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "specify-cli"
33
version = "0.11.5.dev0"
44
description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)."
5+
readme = "README.md"
56
requires-python = ">=3.11"
67
dependencies = [
78
"typer>=0.24.0",

0 commit comments

Comments
 (0)