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