fix: handle workflow trigger permission gracefully

This commit is contained in:
Andy Lee
2025-07-24 19:25:11 -07:00
parent 9000a7083d
commit d45c013806
2 changed files with 61 additions and 1 deletions

View File

@@ -76,6 +76,16 @@ jobs:
- name: Trigger CI build
run: |
echo "🚀 Manually triggering CI for the new version..."
# Check if we have a PAT for triggering workflows
if [ -z "${{ secrets.WORKFLOW_PAT }}" ]; then
echo "⚠️ No WORKFLOW_PAT found. CI will be triggered by the push event."
echo " Note: If CI doesn't trigger automatically, you'll need to:"
echo " 1. Add a Personal Access Token with 'workflow' scope as WORKFLOW_PAT secret"
echo " 2. Or manually run the CI workflow after this release completes"
exit 0
fi
gh workflow run "CI - Build Multi-Platform Packages" \
--ref main \
-f publish=false
@@ -83,7 +93,7 @@ jobs:
# Give GitHub a moment to register the new workflow run
sleep 5
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.WORKFLOW_PAT || secrets.GITHUB_TOKEN }}
- name: Wait for CI to complete
id: wait-for-ci
@@ -91,6 +101,45 @@ jobs:
echo "⏳ Waiting for CI to build new version..."
COMMIT_SHA="${{ steps.push-version.outputs.commit-sha }}"
# First, wait a bit for CI to potentially start
echo "⏳ Waiting for CI to start..."
sleep 30
# Check if there's any CI run for this commit
CI_EXISTS=$(gh run list \
--workflow="CI - Build Multi-Platform Packages" \
--commit=$COMMIT_SHA \
--json databaseId \
--jq 'length')
if [ "$CI_EXISTS" -eq "0" ]; then
echo "⚠️ No CI run found for commit $COMMIT_SHA"
echo " This might be because:"
echo " 1. WORKFLOW_PAT is not configured"
echo " 2. CI hasn't started yet"
echo ""
echo " You can manually trigger CI after this release completes:"
echo " gh workflow run 'CI - Build Multi-Platform Packages' --ref main"
echo ""
echo " For now, we'll use the artifacts from the latest successful CI run."
# Get the latest successful CI run
LATEST_RUN=$(gh run list \
--workflow="CI - Build Multi-Platform Packages" \
--status=success \
--json databaseId \
--jq '.[0].databaseId')
if [ -z "$LATEST_RUN" ]; then
echo "❌ No successful CI runs found!"
exit 1
fi
echo "📦 Using artifacts from CI run: $LATEST_RUN"
echo "run-id=$LATEST_RUN" >> $GITHUB_OUTPUT
exit 0
fi
# Wait up to 20 minutes for CI to complete
for i in {1..40}; do
# First check if CI is running

View File

@@ -1,5 +1,16 @@
# Release Guide
## Required: PyPI Configuration
Before releasing, ensure you have configured the PyPI API token:
1. Generate API token at https://pypi.org/manage/account/token/
2. Add as GitHub secret: `PYPI_API_TOKEN`
3. For full automation, also add a Personal Access Token:
- Create PAT at https://github.com/settings/tokens with `workflow` scope
- Add as GitHub secret: `WORKFLOW_PAT`
- This allows the release workflow to trigger CI builds automatically
## 📋 Prerequisites
Before releasing, ensure: