Skip to content

Commit 1e361c7

Browse files
Merge pull request #1 from keycardai/feat/test-release
Feat/test release
2 parents 5a1135d + ae2135b commit 1e361c7

File tree

11 files changed

+674
-9
lines changed

11 files changed

+674
-9
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
- name: Install just
3232
uses: extractions/setup-just@v2
3333

34+
- name: Sync dependencies
35+
run: uv sync --all-extras --all-packages
36+
3437
- name: Detect package changes
3538
id: changes
3639
run: |

.github/workflows/pr.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
812
jobs:
913
validate-commits:
1014
runs-on: ubuntu-latest
@@ -54,3 +58,77 @@ jobs:
5458

5559
- name: Run tests
5660
run: just test
61+
62+
release-preview:
63+
runs-on: ubuntu-latest
64+
needs: [validate-commits, lint-and-test]
65+
if: github.event_name == 'pull_request'
66+
67+
steps:
68+
- name: Checkout Repository
69+
uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
73+
- name: Setup Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: "3.12"
77+
78+
- name: Install uv
79+
uses: astral-sh/setup-uv@v4
80+
81+
- name: Install just
82+
uses: extractions/setup-just@v2
83+
84+
- name: Install dependencies
85+
run: uv sync --all-extras
86+
87+
- name: Generate release preview
88+
id: release-preview
89+
run: |
90+
# Get version preview information using the Python script
91+
version_preview=$(uv run python scripts/version_preview.py --format github-summary)
92+
93+
echo "preview<<EOF" >> $GITHUB_OUTPUT
94+
echo "$version_preview" >> $GITHUB_OUTPUT
95+
echo "EOF" >> $GITHUB_OUTPUT
96+
97+
# Check if there are any changes by looking for version information
98+
changes=$(uv run python scripts/version_preview.py --format json)
99+
if [ "$changes" = "[]" ] || [ -z "$changes" ]; then
100+
echo "has_changes=false" >> $GITHUB_OUTPUT
101+
else
102+
echo "has_changes=true" >> $GITHUB_OUTPUT
103+
fi
104+
105+
- name: Display release preview
106+
if: steps.release-preview.outputs.has_changes == 'true'
107+
run: |
108+
# Use cat with here document to safely handle special characters
109+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
110+
${{ steps.release-preview.outputs.preview }}
111+
112+
### 📝 Changelog Preview
113+
114+
```
115+
EOF
116+
just preview-changelog >> $GITHUB_STEP_SUMMARY
117+
echo '```' >> $GITHUB_STEP_SUMMARY
118+
119+
- name: No release preview
120+
if: steps.release-preview.outputs.has_changes == 'false'
121+
run: |
122+
# Use cat with here document to safely handle special characters
123+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
124+
${{ steps.release-preview.outputs.preview }}
125+
EOF
126+
127+
- name: Comment on PR with release preview
128+
if: github.event_name == 'pull_request'
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
GH_REPO: ${{ github.repository }}
132+
PR_NUMBER: ${{ github.event.number }}
133+
run: |
134+
uv run python scripts/pr_comment.py

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ jobs:
6767
uses: astral-sh/setup-uv@v4
6868

6969
- name: Install dependencies
70-
run: uv sync --all-extras
70+
run: uv sync --all-extras --all-packages
7171

7272
- name: Build package
7373
run: |
7474
uv build --package ${PACKAGE}
7575
7676
- name: Publish to PyPI
7777
run: |
78-
uv publish
78+
uv publish --index testpypi

justfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Setup development environment
2+
dev-setup:
3+
uv run pre-commit install
4+
uv sync --all-extras --all-packages
5+
16
# Build the project
27
build:
38
uv sync --all-packages
@@ -53,6 +58,10 @@ preview-changelog BASE_BRANCH="origin/main":
5358
changelog-preview BASE_BRANCH="origin/main":
5459
uv run python scripts/changelog.py preview {{BASE_BRANCH}}
5560

61+
# Preview expected version changes for packages with unreleased changes
62+
preview-versions FORMAT="markdown":
63+
uv run python scripts/version_preview.py --format {{FORMAT}}
64+
5665
# Detect packages with unreleased changes
5766
detect-changes:
5867
uv run python scripts/changelog.py changes --output-format github

packages/mcp-fastmcp/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ vcs = "git"
4848
pattern = "(?P<base>\\d+\\.\\d+\\.\\d+)-keycardai-mcp-fastmcp"
4949
style = "pep440"
5050

51+
[[tool.uv.index]]
52+
name = "testpypi"
53+
url = "https://test.pypi.org/simple/"
54+
publish-url = "https://test.pypi.org/legacy/"
55+
explicit = true
56+
5157
[tool.hatch.build.targets.wheel]
5258
packages = ["src/keycardai"]
5359

packages/mcp/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ vcs = "git"
4444
pattern = "(?P<base>\\d+\\.\\d+\\.\\d+)-keycardai-mcp"
4545
style = "pep440"
4646

47+
[[tool.uv.index]]
48+
name = "testpypi"
49+
url = "https://test.pypi.org/simple/"
50+
publish-url = "https://test.pypi.org/legacy/"
51+
explicit = true
52+
4753
[tool.hatch.build.targets.wheel]
4854
packages = ["src/keycardai"]
4955

packages/oauth/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ vcs = "git"
5151
pattern = "(?P<base>\\d+\\.\\d+\\.\\d+)-keycardai-oauth"
5252
style = "pep440"
5353

54+
[[tool.uv.index]]
55+
name = "testpypi"
56+
url = "https://test.pypi.org/simple/"
57+
publish-url = "https://test.pypi.org/legacy/"
58+
explicit = true
59+
5460
[tool.hatch.build.targets.wheel]
5561
packages = ["src/keycardai"]
5662

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ keywords = ["keycard", "oauth", "authentication", "security", "api"]
2525

2626
# This is a namespace/workspace root package with no source code
2727
# All functionality is provided by workspace member packages
28-
dependencies = [
29-
"pre-commit>=4.3.0",
30-
]
28+
dependencies = []
3129

3230
# Optional dependencies for development
3331
[project.optional-dependencies]
@@ -38,6 +36,8 @@ dev = [
3836
"isort>=5.13.2",
3937
"mypy>=1.14.1",
4038
"ruff>=0.12.10",
39+
"pre-commit>=4.3.0",
40+
"commitizen>=3.29.0",
4141
]
4242

4343
[project.urls]
@@ -94,6 +94,8 @@ dev = [
9494
"pytest>=8.4.1",
9595
"pytest-asyncio>=1.1.0",
9696
"ruff>=0.12.10",
97+
"pre-commit>=4.3.0",
98+
"commitizen>=3.29.0",
9799
]
98100

99101
# Configure as a namespace/workspace root package

0 commit comments

Comments
 (0)