Skip to content

Commit

Permalink
Update pr-deploy.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Dominic <[email protected]>
  • Loading branch information
dominic-source authored Jul 31, 2024
1 parent 6e9dd1f commit c4c3a57
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pr-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,26 @@ sudo docker run -d -p $FREE_PORT:$EXPOSED_PORT --name $PR_ID $PR_ID
echo "Start SSH session..."

# Checks if serveo
check_serveo() {
grep -q "ssh: connect to host serveo.net port 22: Connection refused" serveo_output.log || grep -q "ssh: connect to host serveo.net port 22: Connection timed out" serveo_output.log
}

# Set up tunneling using Serveo with a random high-numbered port
nohup ssh -tt -o StrictHostKeyChecking=no -R 80:localhost:$FREE_PORT serveo.net > serveo_output.log 2>&1 &
sleep 3

# Check if Serveo tunnel was set up successfully
if [ check_serveo ]; then
DEPLOYED_URL=$(grep "Forwarding HTTP traffic from" serveo_output.log | tail -n 1 | awk '{print $5}')
else
# check_serveo() {
# grep -q "ssh: connect to host serveo.net port 22: Connection refused" serveo_output.log || grep -q "ssh: connect to host serveo.net port 22: Connection timed out" serveo_output.log
# }

# # Set up tunneling using Serveo with a random high-numbered port
# nohup ssh -tt -o StrictHostKeyChecking=no -R 80:localhost:$FREE_PORT serveo.net > serveo_output.log 2>&1 &
# sleep 3

# # Check if Serveo tunnel was set up successfully
# if [ check_serveo ]; then
# DEPLOYED_URL=$(grep "Forwarding HTTP traffic from" serveo_output.log | tail -n 1 | awk '{print $5}')
# else
nohup ssh -tt -o StrictHostKeyChecking=no -R 80:localhost:$FREE_PORT ssh.localhost.run > localhost_run_output.log 2>&1 &
sleep 3
if grep -q "Connect to" localhost_run_output.log; then
DEPLOYED_URL=$(grep "https://" localhost_run_output.log | tail -n 1 | awk '{print $NF}')
else
DEPLOYED_URL=""
fi
fi
# fi


# Output the final JSON
Expand Down

0 comments on commit c4c3a57

Please sign in to comment.