1+ name : Build And Publish
2+ run-name : R#${{ github.run_number }} (${{ github.event.repository.updated_at }}) [${{ github.event.head_commit.message }}]
3+
4+ on :
5+ workflow_dispatch :
6+ push :
7+ branches :
8+ - main
9+
10+ pull_request :
11+ branches : [ main ]
12+
13+ jobs :
14+ build :
15+ runs-on : windows-latest
16+
17+ steps :
18+ - name : Checkout repository
19+ uses : actions/checkout@v4
20+ - name : Initialize directories
21+ shell : pwsh
22+ run : |
23+ mkdir binlogs
24+
25+ - name : Build
26+ shell : pwsh
27+ run : ./build.ps1 /bl:binlogs/build.binlog
28+ env :
29+ DisableWorkloads : ' true'
30+
31+ - name : Publish Exe
32+ shell : pwsh
33+ run : dotnet publish src/Codex.Application/Codex.Application.csproj -o bin/exe /bl:binlogs/publish.exe.binlog
34+
35+ - name : Analyze
36+ shell : pwsh
37+ run : ./analyze.ps1 -BinlogPath binlogs/build.binlog
38+
39+ - name : Ingest
40+ shell : pwsh
41+ run : ./ingest.ps1 -OutputDir bin/web/index
42+
43+ - name : Upload Index Artifact
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : index
47+ path : bin/web/index
48+
49+ - name : Upload Binlogs
50+ if : always()
51+ uses : actions/upload-artifact@v4
52+ with :
53+ name : ${{ github.job }}-binlogs
54+ path : binlogs
55+
56+ test :
57+ runs-on : windows-latest
58+ timeout-minutes : 10
59+
60+ steps :
61+ - name : Checkout repository
62+ uses : actions/checkout@v4
63+
64+ - name : Run Tests
65+ shell : pwsh
66+ run : dotnet test src/Codex.Integration.Tests/Codex.Integration.Tests.csproj
67+ pack :
68+ runs-on : windows-latest
69+
70+ steps :
71+ - name : Checkout repository
72+ uses : actions/checkout@v4
73+ - name : Initialize directories
74+ shell : pwsh
75+ run : |
76+ mkdir binlogs
77+
78+ - name : Set up Wasm
79+ shell : pwsh
80+ run : |
81+ $timestamp = Get-Date -Format "yyyyMMdd.${{ github.run_number }}"
82+
83+ dotnet pack Codex.xln /p:ProjectFilter=pack `
84+ /p:CodexPackMode=CI `
85+ /p:BUILD_REPOSITORY_PROVIDER=GitHub `
86+ /p:VersionSuffix="${timestamp}+$(git rev-parse --short HEAD)" `
87+ /bl:binlogs/pack.binlog `
88+ -o ./bin/packages
89+
90+ - name : Upload Packages Artifact
91+ uses : actions/upload-artifact@v4
92+ with :
93+ name : packages
94+ path : bin/packages
95+
96+ - name : Upload Binlogs
97+ if : always()
98+ uses : actions/upload-artifact@v4
99+ with :
100+ name : ${{ github.job }}-binlogs
101+ path : binlogs
102+
103+ publish :
104+ runs-on : windows-latest
105+
106+ steps :
107+ - name : Checkout repository
108+ uses : actions/checkout@v4
109+ - name : Initialize directories
110+ shell : pwsh
111+ run : |
112+ mkdir binlogs
113+
114+ - name : Set up Wasm
115+ shell : pwsh
116+ working-directory : src/Codex.Web.Wasm
117+ run : |
118+ dotnet workload install wasm-tools
119+
120+ dotnet workload install wasm-experimental
121+
122+ - name : Publish Wasm
123+ shell : pwsh
124+ working-directory : src/Codex.Web.Wasm
125+ run : dotnet publish Codex.Web.Wasm.csproj -o "$Env:GITHUB_WORKSPACE/bin/wasm" /bl:"$Env:GITHUB_WORKSPACE/binlogs/publish.wasm.binlog"
126+
127+ - name : Upload Wasm Artifact
128+ uses : actions/upload-artifact@v4
129+ with :
130+ name : codex.web.wasm
131+ path : bin/wasm/wwwroot
132+
133+ - name : Publish Exe
134+ shell : pwsh
135+ run : dotnet publish src/Codex.Application/Codex.Application.csproj -o bin/exe /bl:binlogs/publish.exe.binlog
136+
137+ - name : Upload Exe Artifact
138+ uses : actions/upload-artifact@v4
139+ with :
140+ name : codex
141+ path : bin/exe
142+
143+ - name : Upload Binlogs
144+ if : always()
145+ uses : actions/upload-artifact@v4
146+ with :
147+ name : ${{ github.job }}-binlogs
148+ path : binlogs
149+
150+ - name : Create WASM deployment
151+ shell : pwsh
152+ run : ./deploywasm.ps1
153+
154+ deploy_github_pages :
155+ runs-on : windows-latest
156+ needs : [build, test, publish]
157+ permissions :
158+ contents : write
159+ pages : write
160+ id-token : write
161+
162+ steps :
163+ - name : Download Wasm Artifact
164+ uses : actions/download-artifact@v4
165+ with :
166+ name : codex.web.wasm
167+ path : ./site-source
168+
169+ - name : Download Codex.exe Artifact
170+ uses : actions/download-artifact@v4
171+ with :
172+ name : codex
173+ path : ./codex
174+
175+ - name : Create WASM deployment
176+ shell : pwsh
177+ run : ./codex/codex.exe deployweb -s ./site-source -t ./site -h pages -m wasm -i "index?_ts{timestamp}=1"
178+
179+ - name : Download Index Artifact
180+ uses : actions/download-artifact@v4
181+ with :
182+ name : index
183+ path : ./site/index
184+
185+ - name : Setup Pages
186+ uses : actions/configure-pages@v4
187+
188+ - name : Upload to GitHub Pages
189+ uses : actions/upload-pages-artifact@v3
190+ with :
191+ path : ./site
192+
193+ - name : Deploy to GitHub Pages
194+ if : github.ref == 'refs/heads/main'
195+ id : deployment
196+ uses : actions/deploy-pages@v4
0 commit comments