Skip to content

Commit 18d4e0a

Browse files
author
Harvish N S
committed
chore: pypi publishing added to development.md
1 parent cba9ca6 commit 18d4e0a

3 files changed

Lines changed: 114 additions & 40 deletions

File tree

.github/workflows/pypi-publish-on-release.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
permissions: {}
99

1010
jobs:
11-
call-test-lint:
11+
call-test:
1212
permissions:
1313
contents: read
1414
pull-requests: read
@@ -18,8 +18,16 @@ jobs:
1818
with:
1919
ref: ${{ github.event.release.target_commitish }}
2020

21+
call-integ-tests:
22+
permissions:
23+
id-token: write
24+
contents: read
25+
actions: read
26+
uses: ./.github/workflows/python-integ.yml
27+
secrets: inherit
28+
2129
build:
22-
needs: call-test-lint
30+
needs: [call-test, call-integ-tests]
2331
runs-on: ubuntu-latest
2432
permissions:
2533
contents: read
@@ -37,17 +45,6 @@ jobs:
3745
- name: Install uv
3846
run: pip install uv
3947

40-
- name: Validate version format
41-
run: |
42-
pip install tomli
43-
VERSION=$(python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
44-
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
45-
echo "Invalid version format: $VERSION"
46-
echo "Expected format: X.Y.Z (e.g., 1.0.0)"
47-
exit 1
48-
fi
49-
echo "Valid version format: $VERSION"
50-
5148
- name: Build distribution packages
5249
run: uv build
5350

@@ -72,5 +69,8 @@ jobs:
7269
name: python-package-distributions
7370
path: dist/
7471

72+
- name: Set up uv
73+
uses: astral-sh/setup-uv@v4
74+
7575
- name: Publish to PyPI
76-
uses: pypa/gh-action-pypi-publish@release/v1
76+
run: uv publish

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

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,28 @@ name: Test PyPI Publishing
22

33
on:
44
workflow_dispatch:
5-
push:
6-
tags:
7-
- 'v*'
85

96
permissions: {}
107

118
jobs:
12-
call-test-lint:
9+
call-test:
1310
permissions:
1411
contents: read
1512
pull-requests: read
1613
security-events: write
1714
actions: read
1815
uses: ./.github/workflows/python.yml
1916

17+
call-integ-tests:
18+
permissions:
19+
id-token: write
20+
contents: read
21+
actions: read
22+
uses: ./.github/workflows/python-integ.yml
23+
secrets: inherit
24+
2025
build:
21-
needs: call-test-lint
26+
needs: [call-test, call-integ-tests]
2227
runs-on: ubuntu-latest
2328
permissions:
2429
contents: read
@@ -28,24 +33,8 @@ jobs:
2833
with:
2934
persist-credentials: false
3035

31-
- name: Set up Python
32-
uses: actions/setup-python@v5
33-
with:
34-
python-version: '3.10'
35-
36-
- name: Install uv
37-
run: pip install uv
38-
39-
- name: Validate version format
40-
run: |
41-
pip install tomli
42-
VERSION=$(python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
43-
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
44-
echo "Invalid version format: $VERSION"
45-
echo "Expected format: X.Y.Z (e.g., 1.0.0)"
46-
exit 1
47-
fi
48-
echo "Valid version format: $VERSION"
36+
- name: Set up uv
37+
uses: astral-sh/setup-uv@v4
4938

5039
- name: Build distribution packages
5140
run: uv build
@@ -71,7 +60,8 @@ jobs:
7160
name: python-package-distributions
7261
path: dist/
7362

63+
- name: Set up uv
64+
uses: astral-sh/setup-uv@v4
65+
7466
- name: Publish to TestPyPI
75-
uses: pypa/gh-action-pypi-publish@release/v1
76-
with:
77-
repository-url: https://test.pypi.org/legacy/
67+
run: uv publish --publish-url https://test.pypi.org/legacy/

DEVELOPMENT.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,96 @@ export LOG_LEVEL=DEBUG
379379
uv run mcp_proxy_for_aws/server.py <endpoint>
380380
```
381381

382+
## Releasing to PyPI
383+
384+
The project uses automated PyPI publishing through GitHub Actions. Releases are triggered by creating a GitHub Release.
385+
386+
### Release Process
387+
388+
1. **Ensure all changes are merged to main branch**
389+
```bash
390+
git checkout main
391+
git pull origin main
392+
```
393+
394+
2. **Create GitHub Release**
395+
396+
Go to the [Releases page](https://github.com/aws/mcp-proxy-for-aws/releases) and click "Draft a new release", then fill in:
397+
398+
- **Tag**: `v1.10.0` (must start with 'v' and follow semantic versioning)
399+
- **Target**: `main`
400+
- **Title**: `v1.10.0`
401+
- **Description**: Click "Generate release notes" for auto-generated notes
402+
403+
Click **"Publish release"** (not "Save draft")
404+
405+
3. **Automated Publishing**
406+
407+
Once the release is published, GitHub Actions will automatically:
408+
- Run all tests and linting checks
409+
- Build distribution packages (wheel and source)
410+
- Publish to PyPI using Trusted Publishing
411+
412+
Monitor the workflow at: [Actions tab](https://github.com/aws/mcp-proxy-for-aws/actions)
413+
414+
### Version Numbering
415+
416+
Follow [Semantic Versioning](https://semver.org/):
417+
- **MAJOR** (v2.0.0): Breaking changes
418+
- **MINOR** (v1.10.0): New features, backward compatible
419+
- **PATCH** (v1.10.1): Bug fixes, backward compatible
420+
421+
Version is managed in `pyproject.toml`: `version = "1.10.0"`
422+
423+
Use Commitizen to bump versions automatically:
424+
```bash
425+
# Bump version based on conventional commits
426+
uv run cz bump
427+
428+
# This will update both files and create a git tag
429+
```
430+
431+
### Testing Releases
432+
433+
Before creating a production release, you can test with TestPyPI:
434+
435+
```bash
436+
# Create a test tag
437+
git tag v1.10.0-beta
438+
git push origin v1.10.0-beta
439+
440+
# This triggers the TestPyPI workflow
441+
# Monitor at: https://github.com/aws/mcp-proxy-for-aws/actions
442+
```
443+
444+
### Troubleshooting Releases
445+
446+
**Release workflow failed:**
447+
- Check the Actions tab for error details
448+
- Ensure all tests pass locally: `uv run pytest`
449+
- Verify the tag follows semantic versioning format
450+
451+
**Version already exists on PyPI:**
452+
- PyPI doesn't allow re-uploading the same version
453+
- Create a new patch version (e.g., v1.10.1)
454+
- Delete and recreate the tag if needed:
455+
```bash
456+
git tag -d v1.10.0
457+
git push origin --delete v1.10.0
458+
```
459+
460+
**Trusted Publishing authentication failed:**
461+
- Verify PyPI Trusted Publisher is configured correctly
462+
- Check that the workflow file name matches the PyPI configuration
463+
- Ensure the environment name is set to `pypi`
464+
382465
## Additional Resources
383466

384467
- [MCP Specification](https://spec.modelcontextprotocol.io/)
385468
- [FastMCP Documentation](https://fastmcp.readthedocs.io/)
386469
- [AWS SDK for Python (Boto3)](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html)
387470
- [Project README](README.md)
471+
- [PyPI Publishing Guide](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/)
388472

389473
---
390474

0 commit comments

Comments
 (0)