Repository navigation
122 lines (103 loc) · 3.46 KB
/
Copy pathdeploy-cdd-web-ui.yml
File metadata and controls
122 lines (103 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Deploy Web UI to GitHub Pages
on:
push:
branches: [master]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
env:
DEPLOY_LOCATION: /cdd-web-ui
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout main site (offscale.github.io)
uses: actions/checkout@v7
with:
path: main-site
- name: Checkout cdd-web-ui
uses: actions/checkout@v7
with:
repository: SamuelMarks/cdd-web-ui
path: cdd-web-ui
- name: Checkout cdd-browser-sdk
uses: actions/checkout@v7
with:
repository: SamuelMarks/cdd-browser-sdk
path: cdd-browser-sdk
- name: Checkout cdd-docs-ui
uses: actions/checkout@v7
with:
repository: SamuelMarks/cdd-docs-ui
path: cdd-docs-ui
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 'lts/*'
- name: Validate and Test Main Site (offscale.github.io)
working-directory: ./main-site
run: |
npm ci --ignore-scripts
npm run typecheck
npm run lint
npm test
- name: Install Binaryen
run: sudo apt-get update && sudo apt-get install -y binaryen
- name: Build cdd-browser-sdk
working-directory: ./cdd-browser-sdk
run: |
npm ci --ignore-scripts
npm run build
- name: Build cdd-docs-ui
working-directory: ./cdd-docs-ui
run: |
npm ci --ignore-scripts
npm run build
- name: Install UI Dependencies
working-directory: ./cdd-web-ui
run: npm install --ignore-scripts
- name: Fetch and Optimize WASM Binaries
working-directory: ./cdd-web-ui
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build:wasm
for wasm_file in public/assets/wasm/*.wasm; do
[ -f "$wasm_file" ] || continue
filename=$(basename "$wasm_file")
echo "Optimizing $filename..."
wasm-opt -O3 "$wasm_file" -o "${wasm_file}.opt" && mv "${wasm_file}.opt" "$wasm_file" || rm -f "${wasm_file}.opt"
done
- name: Compute base-href and Build Angular App
working-directory: ./cdd-web-ui
run: |
echo "Building Angular with --base-href=/cdd-web-ui/"
npx ng build --configuration production --base-href /cdd-web-ui/
- name: Combine Site Artifacts
run: |
rm -rf main-site/cdd-web-ui
cp -r cdd-web-ui/dist/cdd-web-ui/browser main-site/cdd-web-ui
cp main-site/cdd-web-ui/index.html main-site/cdd-web-ui/404.html
cp main-site/cdd-web-ui/index.html main-site/404.html
for route in workspace login auth-callback dashboard dashboard/organizations dashboard/repositories dashboard/secrets dashboard/audit-logs; do
mkdir -p "main-site/cdd-web-ui/$route"
cp main-site/cdd-web-ui/index.html "main-site/cdd-web-ui/$route/index.html"
done
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: ./main-site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5