Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,36 @@ jobs:
with:
python-version: "3.10"

- name: Check if version already published
id: version-check
run: |
VERSION=$(cat sdk_reforge/VERSION | tr -d '\n')
echo "Current version: $VERSION"

# Check if this version exists on PyPI
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/sdk-reforge/$VERSION/json")

if [ "$HTTP_STATUS" = "200" ]; then
echo "Version $VERSION already exists on PyPI"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Version $VERSION not found on PyPI, proceeding with publish"
echo "skip=false" >> $GITHUB_OUTPUT
fi

- name: Install Poetry
if: steps.version-check.outputs.skip == 'false'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true

- name: Install dependencies
if: steps.version-check.outputs.skip == 'false'
run: |
poetry install --no-interaction

- name: Run tests
if: steps.version-check.outputs.skip == 'false'
run: poetry run pytest
env:
REFORGE_INTEGRATION_TEST_SDK_KEY: ${{ secrets.REFORGE_INTEGRATION_TEST_SDK_KEY }}
Expand All @@ -44,9 +64,11 @@ jobs:
IS_A_NUMBER: 1234

- name: Build package
if: steps.version-check.outputs.skip == 'false'
run: poetry build

- name: Publish to PyPI
if: steps.version-check.outputs.skip == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
Loading