Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Improved CI/CD Public IP resolution (#2368)

Rich Turner5b701b88af71
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 8817be084..65b6d68ff 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -201,9 +201,20 @@ jobs:
id: ip-address
shell: bash
run: |
- set -e
- PUBLIC_IPV4=$(curl -sf v4.ident.me 2>/dev/null || true)
- PUBLIC_IPV6=$(curl -sf v6.ident.me 2>/dev/null || true)
+ OPTS="-sf -m 5"
+
+ # Try Primary v4 -> Fallback v4 -> Default to empty
+ PUBLIC_IPV4=$(curl $OPTS v4.ident.me || curl $OPTS 4.tnedi.me || true)
+
+ # Try Primary v6 -> Fallback v6 -> Default to empty
+ PUBLIC_IPV6=$(curl $OPTS v6.ident.me || curl $OPTS 6.tnedi.me || true)
+
+ # Validation: Ensure at least one IP was found
+ if [[ -z "$PUBLIC_IPV4" && -z "$PUBLIC_IPV6" ]]; then
+ echo "::error::Could not determine Public IP (both v4 and v6 failed)."
+ exit 1
+ fi
+
echo "ipv4=$PUBLIC_IPV4" >> $GITHUB_OUTPUT
echo "ipv6=$PUBLIC_IPV6" >> $GITHUB_OUTPUT