diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index cd4a170..1de7ffa 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,8 +1,6 @@ name: publish-pypi on: - release: - types: [published] workflow_dispatch: inputs: upload: @@ -11,38 +9,7 @@ on: default: 'true' jobs: - update-version: - runs-on: ubuntu-latest - permissions: - contents: write - if: github.event_name == 'release' - - steps: - - uses: actions/checkout@v5 - with: - ref: main - - - name: Extract version from tag - id: version - run: | - VERSION=${{ github.event.release.tag_name }} - VERSION=${VERSION#v} # Remove 'v' prefix if present - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Update pyproject.toml - run: | - sed -i 's/version = "[^"]*"/version = "${{ steps.version.outputs.version }}"/' pyproject.toml - - - name: Commit and push version update - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add pyproject.toml - git commit -m "chore: bump version to ${{ steps.version.outputs.version }}" - git push origin main - build: - needs: update-version runs-on: ubuntu-latest steps: diff --git a/pyproject.toml b/pyproject.toml index 5e645f2..178b8b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "struct" -version = "1.0.0" +version = "2.8.1" description = "A structured data processing tool" readme = "README.md" license = {text = "MIT"} diff --git a/struct_module/__init__.py b/struct_module/__init__.py index 89215ed..f0e7330 100644 --- a/struct_module/__init__.py +++ b/struct_module/__init__.py @@ -1,2 +1,6 @@ -# Struct Module -__version__ = '1.0.0' +from importlib.metadata import version, PackageNotFoundError + +try: + __version__ = version('struct') +except PackageNotFoundError: + __version__ = "unknown" diff --git a/struct_module/mcp_server.py b/struct_module/mcp_server.py index 8a4f146..024d807 100644 --- a/struct_module/mcp_server.py +++ b/struct_module/mcp_server.py @@ -18,13 +18,14 @@ from struct_module.commands.generate import GenerateCommand from struct_module.commands.validate import ValidateCommand +from struct_module import __version__ class StructMCPServer: """FastMCP-based MCP Server for struct tool operations.""" def __init__(self): - self.app = FastMCP("struct-mcp-server", version="1.0.0") + self.app = FastMCP("struct-mcp-server", version=__version__) self.logger = logging.getLogger(__name__) self._register_tools()