44 push :
55 branches :
66 - main
7+ paths-ignore :
8+ - ' docs/**'
9+ - ' *.md'
710 workflow_dispatch :
811
912permissions :
@@ -14,16 +17,112 @@ concurrency:
1417 cancel-in-progress : true
1518
1619jobs :
20+ classify :
21+ runs-on : ubuntu-latest
22+ timeout-minutes : 3
23+ outputs :
24+ scope : ${{ steps.scope.outputs.scope }}
25+ steps :
26+ - name : Checkout history for trusted path classification
27+ uses : actions/checkout@v7
28+ with :
29+ fetch-depth : 0
30+
31+ - name : Test the fail-safe classifier
32+ run : npm run actions:scope:test
33+
34+ - name : Classify changed paths
35+ id : scope
36+ env :
37+ BEFORE_SHA : ${{ github.event.before }}
38+ EVENT_NAME : ${{ github.event_name }}
39+ run : |
40+ if [[ "$EVENT_NAME" == 'workflow_dispatch' || -z "$BEFORE_SHA" || "$BEFORE_SHA" =~ ^0+$ ]]; then
41+ printf 'scope=full\n' >> "$GITHUB_OUTPUT"
42+ exit 0
43+ fi
44+ git diff --name-only "$BEFORE_SHA" "$GITHUB_SHA" | node scripts/orbit-actions-scope.mjs
45+
46+ frontend :
47+ needs : classify
48+ if : ${{ needs.classify.outputs.scope != 'docs' }}
49+ runs-on : ubuntu-latest
50+ timeout-minutes : 12
51+ steps :
52+ - name : Checkout exact production candidate
53+ uses : actions/checkout@v7
54+
55+ - name : Set up Node
56+ uses : actions/setup-node@v7
57+ with :
58+ node-version : 24
59+ cache : npm
60+
61+ - name : Install dependencies
62+ run : npm ci
63+
64+ - name : Build and verify the production frontend once
65+ run : npm run verify:frontend:production
66+
67+ - name : Create the verified asset manifest
68+ run : |
69+ find dist/client -type f -print0 \
70+ | sort -z \
71+ | xargs -0 sha256sum > production-assets.sha256
72+ sha256sum --check production-assets.sha256
73+
74+ - name : Upload verified production assets
75+ uses : actions/upload-artifact@v6
76+ with :
77+ name : orbit-production-assets-${{ github.sha }}
78+ path : |
79+ dist/client
80+ production-assets.sha256
81+ if-no-files-found : error
82+ retention-days : 1
83+
84+ backend :
85+ needs : classify
86+ runs-on : ubuntu-latest
87+ timeout-minutes : 12
88+ steps :
89+ - name : Checkout backend candidate
90+ if : ${{ needs.classify.outputs.scope == 'full' }}
91+ uses : actions/checkout@v7
92+
93+ - name : Set up Node
94+ if : ${{ needs.classify.outputs.scope == 'full' }}
95+ uses : actions/setup-node@v7
96+ with :
97+ node-version : 24
98+ cache : npm
99+
100+ - name : Install dependencies
101+ if : ${{ needs.classify.outputs.scope == 'full' }}
102+ run : npm ci
103+
104+ - name : Verify D1, Worker, CLI and security behavior
105+ if : ${{ needs.classify.outputs.scope == 'full' }}
106+ run : npm run test:d1 && npm run orbit:test:cli
107+
108+ - name : Record frontend-only backend decision
109+ if : ${{ needs.classify.outputs.scope != 'full' }}
110+ run : echo 'No backend/security path changed; the fail-safe classifier selected frontend validation.'
111+
17112 deploy :
18- if : ${{ github.ref == 'refs/heads/main' }}
113+ needs :
114+ - classify
115+ - frontend
116+ - backend
117+ if : ${{ needs.frontend.result == 'success' && needs.backend.result == 'success' }}
19118 runs-on : ubuntu-latest
20- timeout-minutes : 20
119+ timeout-minutes : 8
21120 environment :
22121 name : production
23122 url : https://orbit.sametbasbug.dev
24123
25124 steps :
26- - name : Checkout
125+ - name : Checkout the verified commit
27126 uses : actions/checkout@v7
28127
29128 - name : Set up Node
@@ -32,20 +131,21 @@ jobs:
32131 node-version : 24
33132 cache : npm
34133
35- - name : Install dependencies
134+ - name : Install deployment dependencies
36135 run : npm ci
37136
38- - name : Verify application and static output
39- run : |
40- npm run check
41- npm run build
137+ - name : Download verified production assets
138+ uses : actions/download-artifact@v7
139+ with :
140+ name : orbit-production-assets-${{ github.sha }}
141+ path : .
42142
43- - name : Build and verify the live bundle
143+ - name : Verify artifact and commit identity
44144 run : |
45- npm run production:config:check
46- npm run worker:build: production:live
145+ test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
146+ sha256sum --check production-assets.sha256
47147
48- - name : Deploy the main branch
148+ - name : Deploy the verified main artifact
49149 env :
50150 CLOUDFLARE_ACCOUNT_ID : ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
51151 CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
0 commit comments