@@ -23,7 +23,8 @@ permissions:
2323
2424jobs :
2525 publish :
26- runs-on : ubuntu-latest
26+ # Use self-hosted runners with GitHub-hosted fallback
27+ runs-on : ${{ vars.USE_SELF_HOSTED_RUNNERS != 'false' && fromJSON('["self-hosted", "arc", "the1studio", "org"]') || 'ubuntu-latest' }}
2728 timeout-minutes : 20 # FIX: Add job-level timeout
2829 name : Auto-publish UPM packages
2930
3334 with :
3435 fetch-depth : 2 # Need previous commit for diff
3536
37+ - name : Install dependencies
38+ run : |
39+ # Fix APT sources to use HTTPS instead of HTTP (port 80 blocked)
40+ sudo sed -i 's|http://archive.ubuntu.com|https://archive.ubuntu.com|g' /etc/apt/sources.list
41+ sudo sed -i 's|http://security.ubuntu.com|https://security.ubuntu.com|g' /etc/apt/sources.list
42+
43+ # Disable PPA repositories
44+ sudo mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak 2>/dev/null || true
45+ sudo mkdir -p /etc/apt/sources.list.d
46+
47+ sudo apt-get update -qq
48+ sudo apt-get install -y -qq jq
49+
3650 - name : Setup Node.js
3751 uses : actions/setup-node@v6
3852 with :
@@ -121,12 +135,12 @@ jobs:
121135
122136 # FIX MAJOR-2: Add rate limit detection and backoff for npm commands
123137 npm_view_with_retry() {
124- local package_spec="$1"
138+ # Accept all arguments to support: npm_view_with_retry <package> [field...]
125139 local max_attempts=5
126140 local attempt=1
127141
128142 while [ $attempt -le $max_attempts ]; do
129- if output=$(npm view "$package_spec " --registry "$UPM_REGISTRY" 2>&1); then
143+ if output=$(npm view "$@ " --registry "$UPM_REGISTRY" 2>&1); then
130144 echo "$output"
131145 return 0
132146 fi
@@ -298,7 +312,7 @@ jobs:
298312
299313 # FIX M-2: Use npm/npx semver for accurate version comparison (with rate limit handling)
300314 echo "🔍 Checking version ordering..."
301- latest_version=$(npm_view_with_retry "$package_name" 2>/dev/null | grep '^version:' | awk '{print $2}' || echo "0.0.0")
315+ latest_version=$(npm_view_with_retry "$package_name" version 2>/dev/null || echo "0.0.0")
302316 if [ "$latest_version" = "" ]; then
303317 latest_version="0.0.0"
304318 fi
@@ -433,7 +447,7 @@ jobs:
433447 echo "🔍 Verifying publication..."
434448 sleep 3 # Wait for registry to index
435449
436- published_version=$(npm_view_with_retry "${package_name}@${new_version}" 2>/dev/null | grep '^version:' | awk '{print $2}' || echo "")
450+ published_version=$(npm_view_with_retry "${package_name}@${new_version}" version 2>/dev/null || echo "")
437451
438452 if [ "$published_version" = "$new_version" ]; then
439453 echo "✅ Verified: ${package_name}@${new_version} is available on registry"
0 commit comments