From e048f277fd687830d60bf6f00c673f3bc6cb7016 Mon Sep 17 00:00:00 2001 From: Eric Gustin <34000337+EricGustin@users.noreply.github.com> Date: Mon, 17 Mar 2025 14:40:32 -0800 Subject: [PATCH] Fix publish toolkit workflow (#302) There was a bug where if the poetry publish failed, then the slack message would say that it succeeded. I am setting the notion toolkit version to 0.0.1. This is expected to fail. I'm doing this to ensure the E2E issue is fixed. The grep'd string comes from https://github.com/python-poetry/poetry/blob/main/src/poetry/publishing/uploader.py#L246-L249 --- .github/workflows/publish-toolkit.yml | 13 +++++++++++-- toolkits/notion/pyproject.toml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-toolkit.yml b/.github/workflows/publish-toolkit.yml index f940a5b9..738c3c70 100644 --- a/.github/workflows/publish-toolkit.yml +++ b/.github/workflows/publish-toolkit.yml @@ -59,10 +59,19 @@ jobs: VERSION=$(poetry version -s) echo "version=$VERSION" >> $GITHUB_OUTPUT poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} - # Attempt to publish the toolkit to PyPI. Skip if the version already exists - if poetry publish --skip-existing 2>&1 | grep -q "File exists. Skipping"; then + # Attempt to publish the toolkit to PyPI. + # If the toolkit version already exists, skip publishing. + # If another error occurs, exit with the error code so that the step fails. + PUBLISH_OUTPUT=$(poetry publish --skip-existing 2>&1) + PUBLISH_STATUS=$? + if echo "$PUBLISH_OUTPUT" | grep -q "File exists. Skipping"; then echo "Version already exists on PyPI. Skipping publish." echo "skip_publish=true" >> $GITHUB_OUTPUT + elif [ $PUBLISH_STATUS -ne 0 ]; then + echo "Failed to publish package:" + echo "$PUBLISH_OUTPUT" + echo "skip_publish=false" >> $GITHUB_OUTPUT + exit $PUBLISH_STATUS else echo "skip_publish=false" >> $GITHUB_OUTPUT fi diff --git a/toolkits/notion/pyproject.toml b/toolkits/notion/pyproject.toml index c4e944b8..861e5493 100644 --- a/toolkits/notion/pyproject.toml +++ b/toolkits/notion/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "arcade_notion" -version = "0.1.0" +version = "0.0.1" description = "LLM tools for essential Notion interactions such as creating, updating, retrieving, and searching pages." authors = ["ArcadeAI "]