| 
14 | 14 |                 uses: actions/checkout@v5  | 
15 | 15 | 
 
  | 
16 | 16 |             -   name: Use Node.js 22  | 
17 |  | -                uses: actions/setup-node@v5  | 
 | 17 | +                uses: actions/setup-node@v6  | 
18 | 18 |                 with:  | 
19 | 19 |                     node-version: 22  | 
20 | 20 |                     cache: 'npm'  | 
 | 
35 | 35 |                     INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }}  | 
36 | 36 |                     SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }}  | 
37 | 37 | 
 
  | 
 | 38 | +            -   name: Install Nginx  | 
 | 39 | +                run: |  | 
 | 40 | +                    sudo apt-get update  | 
 | 41 | +                    sudo apt-get install -y nginx  | 
 | 42 | +
  | 
 | 43 | +            -   name: Start Docusaurus server  | 
 | 44 | +                run: |  | 
 | 45 | +                    nohup npx docusaurus serve --port 3000 --no-open &  | 
 | 46 | +                    sleep 5  | 
 | 47 | +                    curl -f http://localhost:3000 > /dev/null  | 
 | 48 | +
  | 
 | 49 | +            -   name: Start Nginx with project config  | 
 | 50 | +                run: |  | 
 | 51 | +                    cat > default.conf <<EOF  | 
 | 52 | +                    worker_processes auto;  | 
 | 53 | +                    error_log $(pwd)/logs/error.log;  | 
 | 54 | +                    pid $(pwd)/logs/nginx.pid;  | 
 | 55 | +                    events {}  | 
 | 56 | +                    http {  | 
 | 57 | +                        access_log $(pwd)/logs/access.log;  | 
 | 58 | +                        include $(pwd)/nginx.conf;  | 
 | 59 | +                    }  | 
 | 60 | +                    EOF  | 
 | 61 | +                    sed -i 's|https://apify.github.io/apify-docs|http://localhost:3000|g' default.conf  | 
 | 62 | +                    mkdir -p $(pwd)/logs  | 
 | 63 | +                    nginx -c $(pwd)/default.conf  | 
 | 64 | +                    sleep 1  | 
 | 65 | +
  | 
 | 66 | +            -   name: Run header assertions  | 
 | 67 | +                run: |  | 
 | 68 | +                    set -euo pipefail  | 
 | 69 | +                    function assert_header() {  | 
 | 70 | +                        url=$1  | 
 | 71 | +                        header=$2  | 
 | 72 | +                        expected=$3  | 
 | 73 | +                        shift 3  | 
 | 74 | +                        extra_args=("$@")  | 
 | 75 | +                        actual=$(curl -s -D - -o /dev/null "${extra_args[@]}" "$url" | grep -i "^$header" | tr -d '\r' || true)  | 
 | 76 | +                        echo "→ $url → $actual"  | 
 | 77 | +                        echo "$actual" | grep -q "$expected" || (echo "❌ Expected '$expected' in '$header' for $url" && exit 1)  | 
 | 78 | +                    }  | 
 | 79 | +
  | 
 | 80 | +                    echo "🧪 Checking Nginx responses..."  | 
 | 81 | +
  | 
 | 82 | +                    assert_header "http://localhost:8080/" "Content-Type" "text/html"  | 
 | 83 | +                    assert_header "http://localhost:8080/" "Content-Type" "text/markdown" -H "Accept: text/markdown"  | 
 | 84 | +                    assert_header "http://localhost:8080/platform/proxy/usage" "Content-Type" "text/html"  | 
 | 85 | +                    assert_header "http://localhost:8080/platform/proxy/usage.md" "Content-Type" "text/markdown"  | 
 | 86 | +                    assert_header "http://localhost:8080/platform/proxy/usage" "Content-Type" "text/markdown" -H "Accept: text/markdown"  | 
 | 87 | +                    assert_header "http://localhost:8080/img/docs-og.png" "Content-Type" "image/png"  | 
 | 88 | +                    assert_header "http://localhost:8080/img/javascript-40x40.svg" "Content-Type" "image/svg"  | 
 | 89 | +                    assert_header "http://localhost:8080/llms.txt" "Content-Type" "text/markdown"  | 
 | 90 | +                    assert_header "http://localhost:8080/llms-full.txt" "Content-Type" "text/markdown"  | 
 | 91 | +
  | 
 | 92 | +                    echo "✅ All Nginx header checks passed."  | 
 | 93 | +
  | 
 | 94 | +            -   name: Stop Nginx  | 
 | 95 | +                if: always()  | 
 | 96 | +                run: nginx -c $(pwd)/default.conf -s stop  | 
 | 97 | + | 
38 | 98 |     lint_content:  | 
39 | 99 |         name: Lint markdown content  | 
40 | 100 |         runs-on: ubuntu-latest  | 
 | 
51 | 111 |                     separator: ","  | 
52 | 112 | 
 
  | 
53 | 113 |             -   name: Use Node.js 22  | 
54 |  | -                uses: actions/setup-node@v5  | 
 | 114 | +                uses: actions/setup-node@v6  | 
55 | 115 |                 with:  | 
56 | 116 |                     node-version: 22  | 
57 | 117 |                     cache: 'npm'  | 
 | 
84 | 144 |                 uses: actions/checkout@v5  | 
85 | 145 | 
 
  | 
86 | 146 |             -   name: Use Node.js 22  | 
87 |  | -                uses: actions/setup-node@v5  | 
 | 147 | +                uses: actions/setup-node@v6  | 
88 | 148 |                 with:  | 
89 | 149 |                     node-version: 22  | 
90 | 150 |                     cache: 'npm'  | 
 | 
0 commit comments