fix: release workflow to build new version before publishing

This commit is contained in:
Andy Lee
2025-07-24 19:03:09 -07:00
parent cea1f6f87c
commit 374db0ebb8

View File

@@ -65,40 +65,49 @@ jobs:
git add packages/*/pyproject.toml git add packages/*/pyproject.toml
git commit -m "chore: release v${{ inputs.version }}" git commit -m "chore: release v${{ inputs.version }}"
- name: Get CI run ID - name: Push version update
id: get-ci-run
run: | run: |
# Get the latest successful CI run on the previous commit (before version bump) git push origin HEAD:main
COMMIT_SHA=$(git rev-parse HEAD~1) echo "✅ Pushed version update to main branch"
COMMIT_SHA=$(git rev-parse HEAD)
echo "commit-sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
id: push-version
- name: Wait for CI to complete
id: wait-for-ci
run: |
echo "⏳ Waiting for CI to build new version..."
COMMIT_SHA="${{ steps.push-version.outputs.commit-sha }}"
# Wait up to 20 minutes for CI to complete
for i in {1..40}; do
RUN_ID=$(gh run list \ RUN_ID=$(gh run list \
--workflow="CI - Build Multi-Platform Packages" \ --workflow="CI - Build Multi-Platform Packages" \
--status=success \
--commit=$COMMIT_SHA \ --commit=$COMMIT_SHA \
--json databaseId \ --json databaseId,status \
--jq '.[0].databaseId') --jq '.[] | select(.status == "completed") | .databaseId' | head -1)
if [ -z "$RUN_ID" ]; then if [ ! -z "$RUN_ID" ]; then
echo "❌ No successful CI run found for commit $COMMIT_SHA" echo "✅ Found completed CI run: $RUN_ID"
echo "" echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT
echo "This usually means:" exit 0
echo "1. CI hasn't run on the latest commit yet"
echo "2. CI failed on the latest commit"
echo ""
echo "Please ensure CI passes on main branch before releasing."
exit 1
fi fi
echo "✅ Found CI run: $RUN_ID" echo "⏳ Waiting for CI... (attempt $i/40)"
echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT sleep 30
done
echo "❌ CI did not complete within 20 minutes"
exit 1
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts from CI run - name: Download artifacts from CI run
run: | run: |
echo "📦 Downloading artifacts from CI run ${{ steps.get-ci-run.outputs.run-id }}..." echo "📦 Downloading artifacts from CI run ${{ steps.wait-for-ci.outputs.run-id }}..."
# Download all artifacts (not just wheels-*) # Download all artifacts (not just wheels-*)
gh run download ${{ steps.get-ci-run.outputs.run-id }} \ gh run download ${{ steps.wait-for-ci.outputs.run-id }} \
--dir ./dist-downloads --dir ./dist-downloads
# Consolidate all wheels into packages/*/dist/ # Consolidate all wheels into packages/*/dist/