forked from cortexkit/magic-context
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwait-release.sh
More file actions
executable file
·44 lines (36 loc) · 1.38 KB
/
Copy pathwait-release.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# Wait for the GitHub Actions release workflow to complete for a given tag.
# Usage: ./scripts/wait-release.sh v0.6.1
# Polls every 5 seconds, exits 0 on success, 1 on failure.
set -euo pipefail
TAG="${1:?Usage: wait-release.sh <tag>}"
REPO="cortexkit/opencode-magic-context"
INTERVAL=5
echo "⏳ Waiting for release workflow on ${TAG}..."
while true; do
# Get the latest run for the release workflow triggered by this tag
RUN_JSON=$(gh run list --repo "$REPO" --workflow release.yml --branch "$TAG" --limit 1 --json status,conclusion,databaseId 2>/dev/null || echo "[]")
STATUS=$(echo "$RUN_JSON" | jq -r '.[0].status // "not_found"')
CONCLUSION=$(echo "$RUN_JSON" | jq -r '.[0].conclusion // ""')
RUN_ID=$(echo "$RUN_JSON" | jq -r '.[0].databaseId // ""')
if [ "$STATUS" = "not_found" ]; then
printf "\r Workflow not started yet..."
sleep "$INTERVAL"
continue
fi
if [ "$STATUS" = "completed" ]; then
if [ "$CONCLUSION" = "success" ]; then
echo ""
echo "✅ Release workflow succeeded (run $RUN_ID)"
echo " https://github.com/$REPO/actions/runs/$RUN_ID"
exit 0
else
echo ""
echo "❌ Release workflow failed: conclusion=$CONCLUSION (run $RUN_ID)"
echo " https://github.com/$REPO/actions/runs/$RUN_ID"
exit 1
fi
fi
printf "\r Status: %-12s (run $RUN_ID)" "$STATUS"
sleep "$INTERVAL"
done