File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ if [ " $# " -lt 2 ]; then
6
+ echo " Usage: $0 <endpoint> <git-short-hash>"
7
+ exit 1
8
+ fi
9
+
10
+ ENDPOINT=" $1 "
11
+ TARGET_HASH=" $2 "
12
+ # If no third argument is provided, no delay is applied
13
+ if [ " $# " -ge 3 ]; then
14
+ MAX_DELAY=" $3 "
15
+ fi
16
+
17
+ # Initial delay in seconds (60, then doubles each time)
18
+ DELAY=60
19
+
20
+ echo " Watching $ENDPOINT for Build: staging@$TARGET_HASH ..."
21
+ while true
22
+ do
23
+ PAGE_CONTENT=" $( curl -s " $ENDPOINT " ) "
24
+
25
+ # If the page contains the line with the hash:
26
+ if echo " $PAGE_CONTENT " | grep -q " Build: staging@${TARGET_HASH} " ; then
27
+ echo " Found Build: staging@${TARGET_HASH} !"
28
+ exit 0
29
+ fi
30
+
31
+ echo " Not found yet. Sleeping for ${DELAY} seconds..."
32
+ sleep " $DELAY "
33
+
34
+ # Exponential backoff
35
+ DELAY=$(( DELAY * 2 ))
36
+
37
+ # cap the delay if a maximum delay is provided
38
+ if [ -n " $MAX_DELAY " ] && [ $DELAY -gt $MAX_DELAY ]; then
39
+ DELAY=$MAX_DELAY
40
+ fi
41
+ done
Original file line number Diff line number Diff line change 18
18
environment : production
19
19
secrets :
20
20
DEPLOYMENT_GITHUB_TOKEN : ${{ secrets.UCI_GITHUB_TOKEN }}
21
+ wait-for-deploy :
22
+ runs-on : ubuntu-latest
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+ - name : Wait for deployment to complete
26
+ run : |
27
+ ./.github/scripts/wait-for-deploy.sh https://inbrowser.link ${{ inputs.tag }}
Original file line number Diff line number Diff line change 18
18
environment : staging
19
19
secrets :
20
20
DEPLOYMENT_GITHUB_TOKEN : ${{ secrets.UCI_GITHUB_TOKEN }}
21
+ wait-for-deploy :
22
+ runs-on : ubuntu-latest
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+ - name : Wait for deployment to complete
26
+ run : |
27
+ ./.github/scripts/wait-for-deploy.sh https://inbrowser.dev ${{ inputs.tag }}
You can’t perform that action at this time.
0 commit comments