Skip to content

Commit

Permalink
Add version check before publishing to PyPI (#1624)
Browse files Browse the repository at this point in the history
* Add version check before publishing to PyPI
  • Loading branch information
ogabrielluiz authored Apr 5, 2024
1 parent 03761cf commit 9ef3558
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/pre-release-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,27 @@ jobs:
run: make build base=true
- name: Check Version
id: check-version
# In this step, we should check the version of the package
# and see if it is a version that is already released
# echo version=$(cd src/backend/base && poetry version --short) >> $GITHUB_OUTPUT
# cd src/backend/base && poetry version --short should
# be different than the last release version in pypi
# which we can get from curl -s "https://pypi.org/pypi/langflow/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1
run: |
echo version=$(cd src/backend/base && poetry version --short) >> $GITHUB_OUTPUT
version=$(cd src/backend/base && poetry version --short)
last_released_version=$(curl -s "https://pypi.org/pypi/langflow-base/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1)
if [ "$version" = "$last_released_version" ]; then
echo "Version $version is already released. Skipping release."
exit 1
else
echo version=$version >> $GITHUB_OUTPUT
fi
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
make publish base=true
- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand All @@ -47,11 +66,6 @@ jobs:
prerelease: true
tag: v${{ steps.check-version.outputs.version }}
commit: dev
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
make publish base=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/pre-release-langflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,21 @@ jobs:
- name: Check Version
id: check-version
run: |
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
version=$(cd src/backend/base && poetry version --short)
last_released_version=$(curl -s "https://pypi.org/pypi/langflow/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1)
if [ "$version" = "$last_released_version" ]; then
echo "Version $version is already released. Skipping release."
exit 1
else
echo version=$version >> $GITHUB_OUTPUT
fi
- name: Display pyproject.toml langflow-base Version
run: cat pyproject.toml | grep langflow-base
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
make publish main=true
- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand All @@ -53,11 +65,6 @@ jobs:
prerelease: true
tag: v${{ steps.check-version.outputs.version }}
commit: dev
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
make publish main=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down

0 comments on commit 9ef3558

Please sign in to comment.