Merge pull request #8 from montevive/fix/cd-publish

ci: update publish workflow to check PyPI version using JSON API and …
This commit is contained in:
JM Robles
2025-06-29 22:42:55 +02:00
committed by GitHub

View File

@@ -47,8 +47,9 @@ jobs:
CURRENT_VERSION=$(python -c "import penpot_mcp; print(penpot_mcp.__version__)") CURRENT_VERSION=$(python -c "import penpot_mcp; print(penpot_mcp.__version__)")
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
# Check if this version already exists on PyPI # Check if this version already exists on PyPI using the JSON API
if pip index versions penpot-mcp | grep -q "$CURRENT_VERSION"; then HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/penpot-mcp/$CURRENT_VERSION/json")
if [ "$HTTP_STATUS" = "200" ]; then
echo "version_exists=true" >> $GITHUB_OUTPUT echo "version_exists=true" >> $GITHUB_OUTPUT
echo "Version $CURRENT_VERSION already exists on PyPI" echo "Version $CURRENT_VERSION already exists on PyPI"
else else
@@ -119,12 +120,10 @@ jobs:
- name: Create GitHub Release - name: Create GitHub Release
if: steps.version-check.outputs.version_exists == 'false' if: steps.version-check.outputs.version_exists == 'false'
uses: actions/create-release@v1 uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: v${{ steps.version-check.outputs.current_version }} tag_name: v${{ steps.version-check.outputs.current_version }}
release_name: Release v${{ steps.version-check.outputs.current_version }} name: Release v${{ steps.version-check.outputs.current_version }}
body: | body: |
## Changes in v${{ steps.version-check.outputs.current_version }} ## Changes in v${{ steps.version-check.outputs.current_version }}
@@ -141,20 +140,10 @@ jobs:
See commit history for detailed changes. See commit history for detailed changes.
**Full Changelog**: https://github.com/montevive/penpot-mcp/compare/v${{ steps.version-check.outputs.current_version }}...HEAD **Full Changelog**: https://github.com/montevive/penpot-mcp/compare/v${{ steps.version-check.outputs.current_version }}...HEAD
files: dist/*
draft: false draft: false
prerelease: false prerelease: false
- name: Upload Release Assets
if: steps.version-check.outputs.version_exists == 'false'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: dist/
asset_name: penpot-mcp-${{ steps.version-check.outputs.current_version }}-dist.zip
asset_content_type: application/zip
- name: Notify on success - name: Notify on success
if: steps.version-check.outputs.version_exists == 'false' if: steps.version-check.outputs.version_exists == 'false'
run: | run: |