Skip to content

Guide Notion connect decisions across MCP clients #22

Guide Notion connect decisions across MCP clients

Guide Notion connect decisions across MCP clients #22

Workflow file for this run

name: Publish PyPI
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.version_check.outputs.should_publish }}
package_version: ${{ steps.version_check.outputs.package_version }}
tag_version: ${{ steps.version_check.outputs.tag_version }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Decide whether to publish
id: version_check
run: |
PACKAGE_VERSION="$(python -c "import tomllib, pathlib; data = tomllib.loads(pathlib.Path('pyproject.toml').read_text()); print(data['project']['version'])")"
echo "package_version=${PACKAGE_VERSION}" >> "$GITHUB_OUTPUT"
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
TAG_VERSION="${GITHUB_REF_NAME#v}"
echo "tag_version=${TAG_VERSION}" >> "$GITHUB_OUTPUT"
if [[ "$TAG_VERSION" == "$PACKAGE_VERSION" ]]; then
echo "should_publish=true" >> "$GITHUB_OUTPUT"
else
echo "::notice::Skipping PyPI publish because tag ${TAG_VERSION} does not match package version ${PACKAGE_VERSION}."
echo "should_publish=false" >> "$GITHUB_OUTPUT"
fi
else
echo "tag_version=" >> "$GITHUB_OUTPUT"
echo "should_publish=true" >> "$GITHUB_OUTPUT"
fi
- name: Install build tools
if: steps.version_check.outputs.should_publish == 'true'
run: python -m pip install --upgrade build twine
- name: Install package and test dependencies
if: steps.version_check.outputs.should_publish == 'true'
run: python -m pip install -e .
- name: Run tests
if: steps.version_check.outputs.should_publish == 'true'
run: python -m unittest tests/test_cli.py tests/test_mcp_server.py tests/test_service.py tests/test_state.py
- name: Build distributions
if: steps.version_check.outputs.should_publish == 'true'
run: python -m build
- name: Check distributions
if: steps.version_check.outputs.should_publish == 'true'
run: python -m twine check dist/*
- name: Upload distributions
if: steps.version_check.outputs.should_publish == 'true'
uses: actions/upload-artifact@v4
with:
name: dist-artifacts
path: dist/
publish:
needs: build
if: needs.build.outputs.should_publish == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment:
name: pypi
url: https://pypi.org/p/agent-labbook
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: dist-artifacts
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1