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"
RUN_ID=$(gh run list \ COMMIT_SHA=$(git rev-parse HEAD)
--workflow="CI - Build Multi-Platform Packages" \ echo "commit-sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
--status=success \ id: push-version
--commit=$COMMIT_SHA \
--json databaseId \
--jq '.[0].databaseId')
if [ -z "$RUN_ID" ]; then - name: Wait for CI to complete
echo "❌ No successful CI run found for commit $COMMIT_SHA" id: wait-for-ci
echo "" run: |
echo "This usually means:" echo "⏳ Waiting for CI to build new version..."
echo "1. CI hasn't run on the latest commit yet" COMMIT_SHA="${{ steps.push-version.outputs.commit-sha }}"
echo "2. CI failed on the latest commit"
echo ""
echo "Please ensure CI passes on main branch before releasing."
exit 1
fi
echo "✅ Found CI run: $RUN_ID" # Wait up to 20 minutes for CI to complete
echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT 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: 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/