-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 2.99 KB
/
update-screenshots.yml
File metadata and controls
99 lines (84 loc) · 2.99 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
name: Update GUI Screenshots
# This workflow can be triggered manually or on a schedule
on:
workflow_dispatch:
inputs:
internal_ai_url:
description: 'InternalAI Frontend URL'
required: false
default: 'http://localhost:3000'
schedule:
# Run weekly on Sundays at 2 AM UTC (optional, can be disabled)
- cron: '0 2 * * 0'
jobs:
capture-screenshots:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Checkout InternalAI repository
uses: actions/checkout@v4
with:
repository: DickLundblad/InternalAI
path: InternalAI
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install InternalAI dependencies
working-directory: InternalAI/frontend
run: npm ci
- name: Start InternalAI frontend
working-directory: InternalAI/frontend
run: |
Start-Process powershell -ArgumentList "-Command npm start" -PassThru
# Wait for frontend to be ready
$maxAttempts = 30
$attempt = 0
do {
Start-Sleep -Seconds 2
$attempt++
try {
$response = Invoke-WebRequest -Uri http://localhost:3000 -Method Head -TimeoutSec 2 -ErrorAction Stop
$ready = $true
}
catch {
$ready = $false
}
} while (-not $ready -and $attempt -lt $maxAttempts)
if (-not $ready) {
Write-Error "InternalAI frontend failed to start"
exit 1
}
shell: pwsh
- name: Build screenshot capture tool
run: dotnet build tools/ScreenshotCapture/ScreenshotCapture.csproj --configuration Release
- name: Install Playwright browsers
run: pwsh -c "dotnet tool install --global Microsoft.Playwright.CLI; playwright install chromium"
- name: Capture screenshots
run: dotnet run --project tools/ScreenshotCapture/ScreenshotCapture.csproj --configuration Release --no-build
- name: Check for changes
id: git-check
run: |
git diff --quiet docs/screenshots/ || echo "changed=true" >> $GITHUB_OUTPUT
shell: bash
- name: Commit and push screenshots
if: steps.git-check.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/screenshots/*.png
git commit -m "chore: update GUI screenshots [skip ci]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload screenshots as artifacts
uses: actions/upload-artifact@v4
with:
name: gui-screenshots
path: docs/screenshots/*.png
retention-days: 30