Skip to content

Commit d361a0c

Browse files
Add screenshot publishing workflow and update CI
Introduces a new GitHub Actions workflow to publish screenshots after successful CI runs. Also updates the Windows configuration step in the CI workflow to minimize all windows before running tests.
1 parent 4b989ab commit d361a0c

File tree

2 files changed

+77
-8
lines changed

2 files changed

+77
-8
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
working-directory: build/tests
137137
run: ./test_tray --gtest_color=yes --gtest_filter=TrayTest.TestTrayInit
138138

139-
- name: Configure Windows Tray and Notifications
139+
- name: Configure Windows
140140
if: runner.os == 'Windows'
141141
shell: pwsh
142142
run: |
@@ -146,14 +146,25 @@ jobs:
146146
-OutFile "Enable-AllTrayIcons.ps1"
147147
.\Enable-AllTrayIcons.ps1 -Action Enable -Force # Enable with comprehensive method (resets ALL icon settings)
148148
149-
# Disable Do Not Disturb
150-
$quietHoursPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\QuietHours"
151-
New-Item -Path $quietHoursPath -Force | Out-Null
152-
Set-ItemProperty -Path $quietHoursPath -Name "Enabled" -Value 0
153-
Set-ItemProperty -Path $quietHoursPath -Name "Profile" -Value "Unrestricted"
149+
# Disable Do Not Disturb, using AutoItX
150+
# Download and extract AutoIt portable
151+
Invoke-WebRequest `
152+
-Uri "https://www.autoitscript.com/files/autoit3/autoit-v3.zip" `
153+
-OutFile "autoit-v3.zip"
154+
Expand-Archive -Path "autoit-v3.zip" -DestinationPath "autoit-portable"
155+
156+
# Import the AutoItX PowerShell module from the portable folder
157+
Import-Module "$PWD\autoit-portable\AutoItX\AutoItX.psd1"
158+
159+
# Send Win+N, then Enter after a short delay
160+
Initialize-AU3
161+
Send-AU3Key -Key "{LWINDOWN}n{LWINUP}" -Mode 0
162+
Start-Sleep -Milliseconds 200
163+
Send-AU3Key -Key "{ENTER}" -Mode 0
154164
155-
# Restart notification services
156-
Get-Service -Name "WpnUserService_*" | Restart-Service -Force
165+
# Minimize all windows
166+
$shell = New-Object -ComObject Shell.Application
167+
$shell.MinimizeAll()
157168
158169
- name: Run tests
159170
id: test
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: Publish Screenshots
3+
4+
on:
5+
workflow_run:
6+
workflows: ["CI"]
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
publish:
16+
if: github.event.workflow_run.conclusion == 'success'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Download Artifacts
20+
uses: actions/download-artifact@v7
21+
with:
22+
path: screenshots
23+
pattern: tray-screenshots-*
24+
run-id: ${{ github.event.workflow_run.id }}
25+
26+
- name: Debug screenshots
27+
run: ls -R screenshots
28+
29+
- name: Determine Branch and Path
30+
id: determine
31+
env:
32+
PULL_REQUEST_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
33+
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
34+
run: |
35+
if [ -n "${PULL_REQUEST_NUMBER}" ]; then
36+
PR_NUMBER=${PULL_REQUEST_NUMBER}
37+
BRANCH_PATH="PR-${PULL_REQUEST_NUMBER}"
38+
is_pr=true
39+
else
40+
BRANCH_NAME=$(echo "${HEAD_BRANCH}" | sed 's/\//-/g')
41+
BRANCH_PATH="${BRANCH_NAME}"
42+
is_pr=false
43+
fi
44+
45+
{
46+
echo "branch_path=${BRANCH_PATH}"
47+
echo "is_pr=${is_pr}"
48+
echo "pr_number=${PR_NUMBER}"
49+
} >> "${GITHUB_OUTPUT}"
50+
51+
# debug outputs
52+
cat "${GITHUB_OUTPUT}"
53+
54+
- name: Checkout Screenshots Branch
55+
uses: actions/checkout@v6
56+
with:
57+
ref: screenshots
58+
path: screenshots-repo

0 commit comments

Comments
 (0)