Skip to content

Commit

Permalink
ci: update workflow to skip publishing if package already exists (#3082)
Browse files Browse the repository at this point in the history
fix: Update Makefile to skip publishing if package already exists
  • Loading branch information
ogabrielluiz authored Jul 30, 2024
1 parent 69c089a commit 410cd46
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check-version.outputs.version }}
skipped: ${{ steps.check-version.outputs.skipped }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
Expand All @@ -51,13 +52,17 @@ jobs:
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."
echo skipped=true >> $GITHUB_OUTPUT
exit 0
else
echo version=$version >> $GITHUB_OUTPUT
echo skipped=false >> $GITHUB_OUTPUT
fi
- name: Build project for distribution
if: steps.check-version.outputs.skipped == 'false'
run: make build base=true
- name: Test CLI
if: steps.check-version.outputs.skipped == 'false'
run: |
python -m pip install src/backend/base/dist/*.whl
python -m langflow run --host 127.0.0.1 --port 7860 &
Expand All @@ -75,10 +80,12 @@ jobs:
echo "Server terminated successfully"
fi
- name: Publish to PyPI
if: steps.check-version.outputs.skipped == 'false'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: make publish base=true
- name: Upload Artifact
if: steps.check-version.outputs.skipped == 'false'
uses: actions/upload-artifact@v4
with:
name: dist-base
Expand Down Expand Up @@ -116,7 +123,9 @@ jobs:
echo version=$version >> $GITHUB_OUTPUT
fi
- name: Wait for PyPI Propagation
if: needs.release-base.outputs.skipped == 'false'
run: sleep 300 # wait for 5 minutes to ensure PyPI propagation

- name: Build project for distribution
run: make build main=true
- name: Test CLI
Expand All @@ -125,7 +134,7 @@ jobs:
python -m langflow run --host 127.0.0.1 --port 7860 &
SERVER_PID=$!
# Wait for the server to start
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/api/v1/auto_login; do sleep 2; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/api/v1/health_check; do sleep 2; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
# Terminate the server
kill $SERVER_PID || (echo "Failed to terminate the server" && exit 1)
sleep 10 # give the server some time to terminate
Expand Down

0 comments on commit 410cd46

Please sign in to comment.