Skip to content

Commit c0bb5ad

Browse files
committed
refactor(CD): add publish pypi workflow
1 parent 3d9453c commit c0bb5ad

1 file changed

Lines changed: 64 additions & 64 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
1-
#name: Publish to PyPI
2-
#
3-
#on:
4-
# release:
5-
# types: [published]
6-
# workflow_dispatch: # Allow manual triggering
7-
#
8-
#jobs:
9-
# publish:
10-
# runs-on: ubuntu-latest
11-
# environment:
12-
# name: pypi
13-
# url: https://pypi.org/p/mcpstack
14-
# permissions:
15-
# id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16-
# contents: read
17-
#
18-
# steps:
19-
# - uses: actions/checkout@v4
20-
#
21-
# - name: Set up uv
22-
# uses: astral-sh/setup-uv@v5
23-
# with:
24-
# version: "latest"
25-
# python-version: "3.11"
26-
#
27-
# - name: Extract version from tag
28-
# id: get_version
29-
# run: |
30-
# # Get version from git tag (removes 'v' prefix if present)
31-
# VERSION=${GITHUB_REF#refs/tags/}
32-
# VERSION=${VERSION#v}
33-
# echo "version=$VERSION" >> $GITHUB_OUTPUT
34-
# echo "Publishing version: $VERSION"
35-
#
36-
# - name: Verify tag matches __version__ in src/MCPStack/__init__.py
37-
# run: |
38-
# # Update version in pyproject.toml to match the git tag
39-
# sed -i "s/version = \".*\"/version = \"${{ steps.get_version.outputs.version }}\"/" pyproject.toml
40-
# echo "Updated pyproject.toml version to ${{ steps.get_version.outputs.version }}"
41-
# cat pyproject.toml | grep version
42-
#
43-
# - name: Lock dependencies
44-
# run: uv lock --locked
45-
#
46-
# - name: Sync dependencies including dev
47-
# run: uv sync --all-groups
48-
#
49-
# - name: Run quick tests
50-
# run: |
51-
# uv add pytest==7.4.3
52-
# uv add pytest-asyncio
53-
# uv run pytest tests/ -v --tb=short
54-
#
55-
# - name: Build package
56-
# run: uv build
57-
#
58-
# - name: Verify package
59-
# run: uv run --with twine twine check dist/*
60-
#
61-
# - name: Publish to PyPI
62-
# uses: pypa/gh-action-pypi-publish@release/v1
63-
# with:
64-
# print-hash: true
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch: # Allow manual triggering
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/mcpstack
14+
permissions:
15+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16+
contents: read
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
version: "latest"
25+
python-version: "3.11"
26+
27+
- name: Extract version from tag
28+
id: get_version
29+
run: |
30+
# Get version from git tag (removes 'v' prefix if present)
31+
VERSION=${GITHUB_REF#refs/tags/}
32+
VERSION=${VERSION#v}
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "Publishing version: $VERSION"
35+
36+
- name: Verify tag matches __version__ in src/MCPStack/__init__.py
37+
run: |
38+
# Update version in pyproject.toml to match the git tag
39+
sed -i "s/version = \".*\"/version = \"${{ steps.get_version.outputs.version }}\"/" pyproject.toml
40+
echo "Updated pyproject.toml version to ${{ steps.get_version.outputs.version }}"
41+
cat pyproject.toml | grep version
42+
43+
- name: Lock dependencies
44+
run: uv lock --locked
45+
46+
- name: Sync dependencies including dev
47+
run: uv sync --all-groups
48+
49+
- name: Run quick tests
50+
run: |
51+
uv add pytest==7.4.3
52+
uv add pytest-asyncio
53+
uv run pytest tests/ -v --tb=short
54+
55+
- name: Build package
56+
run: uv build
57+
58+
- name: Verify package
59+
run: uv run --with twine twine check dist/*
60+
61+
- name: Publish to PyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
with:
64+
print-hash: true

0 commit comments

Comments
 (0)