mirror of
https://github.com/github/spec-kit
synced 2026-06-21 13:51:39 +00:00
a57743e3a3
- 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 <223556219+Copilot@users.noreply.github.com>
95 lines
2.9 KiB
YAML
95 lines
2.9 KiB
YAML
name: Create Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
echo "tag=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Building release for $VERSION"
|
|
|
|
- name: Check if release already exists
|
|
id: check_release
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.tag }}"
|
|
if gh release view "$VERSION" >/dev/null 2>&1; then
|
|
echo "exists=true" >> $GITHUB_OUTPUT
|
|
echo "Release $VERSION already exists, skipping..."
|
|
else
|
|
echo "exists=false" >> $GITHUB_OUTPUT
|
|
echo "Release $VERSION does not exist, proceeding..."
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Generate release notes
|
|
if: steps.check_release.outputs.exists == 'false'
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.tag }}"
|
|
VERSION_NO_V=${VERSION#v}
|
|
|
|
# Find previous tag
|
|
PREVIOUS_TAG=$(git tag -l 'v*' --sort=-version:refname | grep -v "^${VERSION}$" | head -n 1)
|
|
if [ -z "$PREVIOUS_TAG" ]; then
|
|
PREVIOUS_TAG=""
|
|
fi
|
|
|
|
# Get commits since previous tag
|
|
if [ -z "$PREVIOUS_TAG" ]; then
|
|
COMMIT_COUNT=$(git rev-list --count HEAD)
|
|
if [ "$COMMIT_COUNT" -gt 20 ]; then
|
|
COMMITS=$(git log --oneline --pretty=format:"- %s" --no-merges HEAD~20..HEAD)
|
|
else
|
|
COMMITS=$(git log --oneline --pretty=format:"- %s" --no-merges)
|
|
fi
|
|
else
|
|
COMMITS=$(git log --oneline --pretty=format:"- %s" --no-merges "$PREVIOUS_TAG"..HEAD)
|
|
fi
|
|
|
|
cat > release_notes.md << NOTES_EOF
|
|
## Install
|
|
|
|
\`\`\`bash
|
|
uv tool install specify-cli@latest
|
|
specify init my-project
|
|
\`\`\`
|
|
|
|
Or install from source:
|
|
|
|
\`\`\`bash
|
|
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git@${VERSION}
|
|
\`\`\`
|
|
|
|
NOTES_EOF
|
|
|
|
echo "## What's Changed" >> release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "$COMMITS" >> release_notes.md
|
|
|
|
- name: Create GitHub Release
|
|
if: steps.check_release.outputs.exists == 'false'
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.tag }}"
|
|
VERSION_NO_V=${VERSION#v}
|
|
gh release create "$VERSION" \
|
|
--title "Spec Kit - $VERSION_NO_V" \
|
|
--notes-file release_notes.md
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|