Skip to content

Commit c4f37c5

Browse files
authored
Toreleon fix ci errors (#20)
* Add CI/CD workflows for testing, version bumping, and PyPI publishing; enhance README with development and CI/CD details; implement comprehensive tests for MCPHub and MCPServers functionality. * Enhance CI workflow by installing all extras with Poetry * Refactor CI workflow to include version bumping and streamline package publishing using Poetry * Update README to clarify MCPHub installation options with framework-specific dependencies * Restrict pull request triggers to the release branch only * Update CI workflow to enable fail-fast strategy and restrict Python versions to 3.12 only * Refactor CI workflows to remove version bumping from CI and add tagging functionality; update README for clarity on automatic versioning and tagging process. * Refactor CI workflows to integrate version bumping and ensure proper versioning before publishing; update version-bump workflow to set outputs for new version. * Bump version to 0.1.6 in pyproject.toml * Refactor CI workflows: remove version-bump workflow and integrate version extraction and tagging directly in the publish job; update package version to 0.1.7 in pyproject.toml
1 parent fad1ad2 commit c4f37c5

File tree

3 files changed

+51
-103
lines changed

3 files changed

+51
-103
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,16 @@ jobs:
3535
- name: Run tests
3636
run: |
3737
poetry run pytest tests/ -v
38-
39-
# Call the version-bump workflow to bump the version before publishing
40-
version-bump:
41-
needs: test
42-
uses: ./.github/workflows/version-bump.yml
43-
# Only run on release branch when push (merge)
44-
if: github.event_name == 'push' && github.ref == 'refs/heads/release'
4538
4639
publish:
47-
needs: version-bump
40+
needs: test
4841
runs-on: ubuntu-latest
4942
# Only run on release branch when push (merge)
5043
if: github.event_name == 'push' && github.ref == 'refs/heads/release'
5144

5245
steps:
5346
- uses: actions/checkout@v3
5447
with:
55-
ref: 'refs/heads/release'
5648
fetch-depth: 0
5749

5850
- name: Set up Python
@@ -64,11 +56,57 @@ jobs:
6456
- name: Install dependencies
6557
run: |
6658
python -m pip install --upgrade pip
67-
python -m pip install poetry
59+
python -m pip install poetry tomlkit
60+
61+
- name: Extract version from pyproject.toml
62+
id: get-version
63+
run: |
64+
# Python script to extract current version
65+
python - << 'EOF'
66+
import tomlkit
67+
import os
68+
69+
# Read current version from pyproject.toml
70+
with open('pyproject.toml', 'r') as f:
71+
pyproject = tomlkit.parse(f.read())
72+
73+
version = pyproject['project']['version']
74+
print(f"Current version: {version}")
75+
76+
# Save the version to environment variables for later steps
77+
with open(os.environ['GITHUB_ENV'], 'a') as f:
78+
f.write(f"PACKAGE_VERSION={version}\n")
79+
80+
# Set output for the workflow
81+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
82+
f.write(f"version={version}\n")
83+
EOF
84+
85+
- name: Check if tag exists
86+
id: check-tag
87+
run: |
88+
TAG="v${PACKAGE_VERSION}"
89+
if git rev-parse $TAG >/dev/null 2>&1; then
90+
echo "Tag $TAG already exists"
91+
echo "tag_exists=true" >> $GITHUB_OUTPUT
92+
else
93+
echo "Tag $TAG does not exist"
94+
echo "tag_exists=false" >> $GITHUB_OUTPUT
95+
fi
96+
97+
- name: Configure Git
98+
if: steps.check-tag.outputs.tag_exists == 'false'
99+
run: |
100+
git config --local user.email "action@github.com"
101+
git config --local user.name "GitHub Action"
68102
69-
- name: Fetch latest changes with updated version
103+
- name: Create and push tag
104+
if: steps.check-tag.outputs.tag_exists == 'false'
70105
run: |
71-
git pull origin release # Make sure we have the latest version after bump
106+
# Create a new tag with the version from pyproject.toml
107+
git tag -a "v${PACKAGE_VERSION}" -m "Release version ${PACKAGE_VERSION}"
108+
# Push the tag to the remote repository
109+
git push origin "v${PACKAGE_VERSION}"
72110
73111
- name: Build and publish
74112
env:

.github/workflows/version-bump.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "mcphub"
7-
version = "0.1.6"
7+
version = "0.1.7"
88
description = "A Python package for managing and integrating Model Context Protocol (MCP) servers with AI frameworks like OpenAI Agents, LangChain, and Autogen"
99
readme = "README.md"
1010
authors = [

0 commit comments

Comments
 (0)