@@ -16,9 +16,12 @@ if [ $# -eq 1 ]; then
1616 echo " π Manual version specified: $NEW_TAG "
1717fi
1818
19- # Step 1: Determine version tag first (before pushing)
19+ # Step 1: Push to main branch
20+ echo " π Pushing to main branch..."
21+ git push origin main
22+
23+ # Step 2: Determine version tag (if not manually specified)
2024if [ -z " $NEW_TAG " ]; then
21- # No manual version provided, auto-increment
2225 echo " π·οΈ Finding latest sidekick version tag..."
2326 LATEST_TAG=$( git tag -l " sidekick-v*" | sort -V | tail -n1)
2427 if [ -z " $LATEST_TAG " ]; then
@@ -36,7 +39,7 @@ if [ -z "$NEW_TAG" ]; then
3639 NEW_PATCH=$(( PATCH + 1 ))
3740 NEW_TAG=" sidekick-v${MAJOR} .${MINOR} .${NEW_PATCH} "
3841
39- echo " π Will auto-increment to version: $NEW_TAG "
42+ echo " π New version: $NEW_TAG "
4043else
4144 # Manual version provided, check if it already exists
4245 if git tag -l " $NEW_TAG " | grep -q " $NEW_TAG " ; then
4548 fi
4649fi
4750
48- # Step 2: Check if there are any changes to push
49- echo " π Checking for changes to push..."
50- git fetch origin main
51- if [ -z " $( git log origin/main..HEAD) " ]; then
52- echo " β οΈ No new commits to push. Skipping to tag creation."
53- SKIP_CI=true
54- else
55- # Step 3: Push to main branch
56- echo " π Pushing to main branch..."
57- git push origin main
58- SKIP_CI=false
59- fi
60-
61- # Step 4: Monitor CI workflow with optimized polling (if we pushed)
62- if [ " $SKIP_CI " != " true" ]; then
63- echo " β³ Waiting for CI to start..."
64- sleep 10
65-
66- # Get the latest workflow run
67- RUN_ID=$( gh run list --limit 1 --json databaseId --jq ' .[0].databaseId' )
68- echo " π Monitoring CI run $RUN_ID ..."
69-
70- # Poll CI status every 15 seconds (optimized for ~2m20s runtime)
71- MAX_WAIT=160 # seconds
72- ELAPSED=0
73- while [ $ELAPSED -lt $MAX_WAIT ]; do
74- STATUS=$( gh run view $RUN_ID --json status --jq ' .status' )
75- CONCLUSION=$( gh run view $RUN_ID --json conclusion --jq ' .conclusion // "pending"' )
76-
77- if [ " $STATUS " = " completed" ]; then
78- if [ " $CONCLUSION " = " success" ]; then
79- echo " β
CI passed successfully!"
80- break
81- else
82- echo " β CI failed with conclusion: $CONCLUSION "
83- exit 1
84- fi
85- fi
86-
87- echo " β³ CI status: $STATUS (${ELAPSED} s elapsed)..."
88- sleep 15
89- ELAPSED=$(( ELAPSED + 15 ))
90- done
91-
92- if [ $ELAPSED -ge $MAX_WAIT ]; then
93- echo " β οΈ CI is taking longer than expected. Check manually: gh run view $RUN_ID "
94- exit 1
95- fi
96- fi
97-
98- # Step 5: Create and push new tag
51+ # Step 3: Create and push new tag
9952echo " π·οΈ Creating tag $NEW_TAG ..."
10053git tag $NEW_TAG -m " Release $NEW_TAG "
10154git push origin $NEW_TAG
10255
103- # Step 6 : Monitor release workflow with optimized polling
56+ # Step 4 : Monitor release workflow with optimized polling
10457echo " β³ Waiting for sidekick release workflow to start..."
10558sleep 10
10659
@@ -114,25 +67,25 @@ ELAPSED=0
11467while [ $ELAPSED -lt $MAX_RELEASE_WAIT ]; do
11568 STATUS=$( gh run view $RELEASE_RUN_ID --json status --jq ' .status' )
11669 CONCLUSION=$( gh run view $RELEASE_RUN_ID --json conclusion --jq ' .conclusion // "pending"' )
117-
70+
11871 if [ " $STATUS " = " completed" ]; then
11972 if [ " $CONCLUSION " = " success" ]; then
120- echo " β
Sidekick release completed successfully!"
73+ echo " β
sidekick release completed successfully!"
12174 echo " π Version $NEW_TAG has been deployed!"
12275 echo " π¦ View release: https://github.com/eliezedeck/AIDevTools/releases/tag/$NEW_TAG "
12376 exit 0
12477 else
125- echo " β Sidekick release failed with conclusion: $CONCLUSION "
78+ echo " β sidekick release failed with conclusion: $CONCLUSION "
12679 exit 1
12780 fi
12881 fi
129-
130- echo " β³ Sidekick release status: $STATUS (${ELAPSED} s elapsed)..."
82+
83+ echo " β³ sidekick release status: $STATUS (${ELAPSED} s elapsed)..."
13184 sleep 10
13285 ELAPSED=$(( ELAPSED + 10 ))
13386done
13487
13588if [ $ELAPSED -ge $MAX_RELEASE_WAIT ]; then
136- echo " β οΈ Sidekick release is taking longer than expected. Check manually: gh run view $RELEASE_RUN_ID "
89+ echo " β οΈ sidekick release is taking longer than expected. Check manually: gh run view $RELEASE_RUN_ID "
13790 exit 1
13891fi
0 commit comments