Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 177 additions & 0 deletions .github/workflows/guangyao-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
name: GuangYao apps

# Builds the downloadable GuangYao apps and publishes them to the "guangyao-desktop" release from main:
# Windows GuangYao-Windows-Setup.exe (per-user installer) + GuangYao-Windows-Portable.zip
# macOS GuangYao-macOS-AppleSilicon.dmg + GuangYao-macOS-Intel.dmg
# The apps are thin native windows around the live site, so every push to the site reaches them through GitHub
# Pages without a rebuild. This workflow only runs when the shell in desktop/ changes. Every build is opened and
# checked on its own system first; only builds that passed are published, and the download links never change.
on:
push:
branches: [main]
paths:
- 'apps/guangyao/desktop/**'
- '.github/workflows/guangyao-desktop.yml'
pull_request:
paths:
- 'apps/guangyao/desktop/**'
- '.github/workflows/guangyao-desktop.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: guangyao-desktop-${{ github.ref }}
cancel-in-progress: true

jobs:
desktop:
name: Desktop (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
- name: macOS Apple silicon
os: macos-15
- name: macOS Intel
os: macos-15-intel
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install PyInstaller, Pillow and pywebview
run: python -m pip install --disable-pip-version-check pyinstaller pillow pywebview
- name: Install Inno Setup
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = Join-Path ${env:ProgramFiles(x86)} 'Inno Setup 6\ISCC.exe'
if (-not (Test-Path $iscc) -and -not (Get-Command iscc -ErrorAction SilentlyContinue)) {
choco install innosetup --no-progress -y
}
- name: Make sure the WebView2 runtime is there (the Windows window uses it)
if: runner.os == 'Windows'
shell: pwsh
run: |
$client = '{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
$keys = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\$client",
"HKCU:\Software\Microsoft\EdgeUpdate\Clients\$client"
$version = $keys | Where-Object { Test-Path $_ } | ForEach-Object { (Get-ItemProperty $_).pv } |
Where-Object { $_ -and $_ -ne '0.0.0.0' } | Select-Object -First 1
if ($version) { Write-Host "WebView2 runtime $version"; exit 0 }
$setup = Join-Path $env:RUNNER_TEMP 'MicrosoftEdgeWebview2Setup.exe'
Invoke-WebRequest 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile $setup
Start-Process -FilePath $setup -ArgumentList '/silent', '/install' -Wait
- name: Stop XProtect scans (they make hdiutil fail with "Resource busy")
if: runner.os == 'macOS'
run: |
sudo pkill -9 XProtect > /dev/null 2>&1 || true
for attempt in $(seq 1 20); do pgrep -x XProtect > /dev/null || break; sleep 3; done
- name: Build and package
run: python apps/guangyao/desktop/build.py --require-installer
- name: Open the built app and check its window shows this commit's GuangYao
run: python apps/guangyao/desktop/smoke_test.py --built --local-site
- name: Install with GuangYao-Windows-Setup.exe, run it, uninstall it
if: runner.os == 'Windows'
shell: pwsh
run: |
$setup = Resolve-Path 'apps/guangyao/desktop/dist/GuangYao-Windows-Setup.exe'
$log = Join-Path $env:RUNNER_TEMP 'guangyao-setup.log'
$process = Start-Process -FilePath $setup -Wait -PassThru -ArgumentList @(
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/TASKS=desktopicon', "/LOG=$log")
if ($process.ExitCode -ne 0) { Get-Content $log -Tail 40; throw "Setup failed with exit code $($process.ExitCode)" }
$app = Join-Path $env:LOCALAPPDATA 'Programs\GuangYao\GuangYao.exe'
if (-not (Test-Path $app)) { throw "GuangYao.exe was not installed to $app" }
$shortcuts = @(
(Join-Path ([Environment]::GetFolderPath('Programs')) 'GuangYao.lnk'),
(Join-Path ([Environment]::GetFolderPath('Desktop')) 'GuangYao.lnk'))
foreach ($link in $shortcuts) { if (-not (Test-Path $link)) { throw "Missing shortcut: $link" } }
$entry = Get-ChildItem 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall' |
Get-ItemProperty | Where-Object DisplayName -eq 'GuangYao'
if (-not $entry) { throw 'GuangYao is missing from Settings > Apps' }
python apps/guangyao/desktop/smoke_test.py --local-site $app
if ($LASTEXITCODE -ne 0) { throw 'The installed app failed its checks' }
Start-Process -FilePath $entry.UninstallString.Trim('"') -Wait -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART'
for ($i = 0; $i -lt 60 -and (Test-Path $app); $i++) { Start-Sleep -Seconds 1 }
if (Test-Path $app) { throw 'Uninstalling left GuangYao.exe behind' }
foreach ($link in $shortcuts) { if (Test-Path $link) { throw "Uninstalling left a shortcut: $link" } }
Write-Host 'Installed, ran and uninstalled cleanly'
- name: Check the Mac app and disk image
if: runner.os == 'macOS'
run: |
APP=apps/guangyao/desktop/dist/GuangYao.app
test "$(plutil -extract CFBundleIdentifier raw "$APP/Contents/Info.plist")" = "io.github.juw12.guangyao.desktop"
test "$(plutil -extract CFBundleShortVersionString raw "$APP/Contents/Info.plist")" = "$(python3 -c 'import json; print(json.load(open("apps/guangyao/desktop/shell.json"))["version"])')"
echo "Architecture: $(lipo -archs "$APP/Contents/MacOS/GuangYao")"
codesign --verify --deep --verbose=2 "$APP"
for image in apps/guangyao/desktop/dist/*.dmg; do hdiutil verify "$image"; done
- uses: actions/upload-artifact@v4
with:
name: GuangYao-${{ runner.os }}-${{ runner.arch }}
path: apps/guangyao/desktop/dist/GuangYao-*
if-no-files-found: error
retention-days: 14

publish:
needs: [desktop]
if: ${{ !cancelled() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: GuangYao-*
path: dist
merge-multiple: true
- name: Publish the apps to the apps release
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
cd dist
FILES=""
for name in GuangYao-Windows-Setup.exe GuangYao-Windows-Portable.zip \
GuangYao-macOS-AppleSilicon.dmg GuangYao-macOS-Intel.dmg; do
if [ -f "$name" ]; then
FILES="$FILES $name"
else
echo "::warning::$name was not built in this run; the release keeps its previous copy (if any)."
fi
done
if [ -z "$FILES" ]; then
echo "::error::No app passed its checks."
exit 1
fi
sha256sum $FILES > SHA256SUMS.txt
cat SHA256SUMS.txt
cat > notes.md <<'EOF'
**Guang Yao Together 光耀同行**: an unofficial Traditional Chinese learning app. The apps open the same Guang Yao Together 光耀同行 as https://juw12.github.io/projects/guangyao/ in their own window.

| Your device | Download | How to install |
| --- | --- | --- |
| **Windows 10/11** | [GuangYao-Windows-Setup.exe](https://github.com/juw12/projects/releases/download/guangyao-desktop/GuangYao-Windows-Setup.exe) | Open it and press Install (no admin needed). If Windows says it protected your PC, choose **More info → Run anyway** (the app is not code-signed yet). Without installing: [GuangYao-Windows-Portable.zip](https://github.com/juw12/projects/releases/download/guangyao-desktop/GuangYao-Windows-Portable.zip). |
| **Mac with Apple chip (M1 and newer)** | [GuangYao-macOS-AppleSilicon.dmg](https://github.com/juw12/projects/releases/download/guangyao-desktop/GuangYao-macOS-AppleSilicon.dmg) | Open it and drag GuangYao to Applications. The first time, macOS blocks it because it is not notarized: **System Settings → Privacy & Security → Open Anyway**. |
| **Mac with Intel chip** | [GuangYao-macOS-Intel.dmg](https://github.com/juw12/projects/releases/download/guangyao-desktop/GuangYao-macOS-Intel.dmg) | Same as above. Not sure which Mac? Apple menu → About This Mac shows **Chip** (Apple) or **Processor** (Intel). |
| **iPhone / iPad** | [Open in Safari](https://juw12.github.io/projects/guangyao/) | Share → **Add to Home Screen** (free, full screen, updates itself). |
| **Android** | [GuangYao-android.apk](https://github.com/juw12/projects/releases/download/guangyao-android/GuangYao-android.apk) | Open it on the phone and allow installing from the browser. |

The apps load GuangYao from the web, so new versions arrive the moment they are published, with no reinstall. Checksums for this build: `SHA256SUMS.txt`.
EOF
{
echo
echo "Built from ${GITHUB_SHA::7}."
} >> notes.md
if gh release view guangyao-desktop --repo "$REPO" > /dev/null 2>&1; then
gh release upload guangyao-desktop $FILES SHA256SUMS.txt --clobber --repo "$REPO"
gh release edit guangyao-desktop --notes-file notes.md --repo "$REPO"
else
gh release create guangyao-desktop $FILES SHA256SUMS.txt --title "Guang Yao Together 光耀同行 for Windows and Mac" \
--notes-file notes.md --latest=false --repo "$REPO"
fi
177 changes: 177 additions & 0 deletions .github/workflows/sync-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
name: SyncLive apps

# Builds the downloadable SyncLive apps and publishes them to the "sync-desktop" release from main:
# Windows SyncLive-Windows-Setup.exe (per-user installer) + SyncLive-Windows-Portable.zip
# macOS SyncLive-macOS-AppleSilicon.dmg + SyncLive-macOS-Intel.dmg
# The apps are thin native windows around the live site, so every push to the site reaches them through GitHub
# Pages without a rebuild. This workflow only runs when the shell in desktop/ changes. Every build is opened and
# checked on its own system first; only builds that passed are published, and the download links never change.
on:
push:
branches: [main]
paths:
- 'apps/sync/desktop/**'
- '.github/workflows/sync-desktop.yml'
pull_request:
paths:
- 'apps/sync/desktop/**'
- '.github/workflows/sync-desktop.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: sync-desktop-${{ github.ref }}
cancel-in-progress: true

jobs:
desktop:
name: Desktop (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
- name: macOS Apple silicon
os: macos-15
- name: macOS Intel
os: macos-15-intel
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install PyInstaller, Pillow and pywebview
run: python -m pip install --disable-pip-version-check pyinstaller pillow pywebview
- name: Install Inno Setup
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = Join-Path ${env:ProgramFiles(x86)} 'Inno Setup 6\ISCC.exe'
if (-not (Test-Path $iscc) -and -not (Get-Command iscc -ErrorAction SilentlyContinue)) {
choco install innosetup --no-progress -y
}
- name: Make sure the WebView2 runtime is there (the Windows window uses it)
if: runner.os == 'Windows'
shell: pwsh
run: |
$client = '{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
$keys = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\$client",
"HKCU:\Software\Microsoft\EdgeUpdate\Clients\$client"
$version = $keys | Where-Object { Test-Path $_ } | ForEach-Object { (Get-ItemProperty $_).pv } |
Where-Object { $_ -and $_ -ne '0.0.0.0' } | Select-Object -First 1
if ($version) { Write-Host "WebView2 runtime $version"; exit 0 }
$setup = Join-Path $env:RUNNER_TEMP 'MicrosoftEdgeWebview2Setup.exe'
Invoke-WebRequest 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile $setup
Start-Process -FilePath $setup -ArgumentList '/silent', '/install' -Wait
- name: Stop XProtect scans (they make hdiutil fail with "Resource busy")
if: runner.os == 'macOS'
run: |
sudo pkill -9 XProtect > /dev/null 2>&1 || true
for attempt in $(seq 1 20); do pgrep -x XProtect > /dev/null || break; sleep 3; done
- name: Build and package
run: python apps/sync/desktop/build.py --require-installer
- name: Open the built app and check its window shows this commit's SyncLive
run: python apps/sync/desktop/smoke_test.py --built --local-site
- name: Install with SyncLive-Windows-Setup.exe, run it, uninstall it
if: runner.os == 'Windows'
shell: pwsh
run: |
$setup = Resolve-Path 'apps/sync/desktop/dist/SyncLive-Windows-Setup.exe'
$log = Join-Path $env:RUNNER_TEMP 'sync-setup.log'
$process = Start-Process -FilePath $setup -Wait -PassThru -ArgumentList @(
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/TASKS=desktopicon', "/LOG=$log")
if ($process.ExitCode -ne 0) { Get-Content $log -Tail 40; throw "Setup failed with exit code $($process.ExitCode)" }
$app = Join-Path $env:LOCALAPPDATA 'Programs\SyncLive\SyncLive.exe'
if (-not (Test-Path $app)) { throw "SyncLive.exe was not installed to $app" }
$shortcuts = @(
(Join-Path ([Environment]::GetFolderPath('Programs')) 'SyncLive.lnk'),
(Join-Path ([Environment]::GetFolderPath('Desktop')) 'SyncLive.lnk'))
foreach ($link in $shortcuts) { if (-not (Test-Path $link)) { throw "Missing shortcut: $link" } }
$entry = Get-ChildItem 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall' |
Get-ItemProperty | Where-Object DisplayName -eq 'SyncLive'
if (-not $entry) { throw 'SyncLive is missing from Settings > Apps' }
python apps/sync/desktop/smoke_test.py --local-site $app
if ($LASTEXITCODE -ne 0) { throw 'The installed app failed its checks' }
Start-Process -FilePath $entry.UninstallString.Trim('"') -Wait -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART'
for ($i = 0; $i -lt 60 -and (Test-Path $app); $i++) { Start-Sleep -Seconds 1 }
if (Test-Path $app) { throw 'Uninstalling left SyncLive.exe behind' }
foreach ($link in $shortcuts) { if (Test-Path $link) { throw "Uninstalling left a shortcut: $link" } }
Write-Host 'Installed, ran and uninstalled cleanly'
- name: Check the Mac app and disk image
if: runner.os == 'macOS'
run: |
APP=apps/sync/desktop/dist/SyncLive.app
test "$(plutil -extract CFBundleIdentifier raw "$APP/Contents/Info.plist")" = "io.github.juw12.sync.desktop"
test "$(plutil -extract CFBundleShortVersionString raw "$APP/Contents/Info.plist")" = "$(python3 -c 'import json; print(json.load(open("apps/sync/desktop/shell.json"))["version"])')"
echo "Architecture: $(lipo -archs "$APP/Contents/MacOS/SyncLive")"
codesign --verify --deep --verbose=2 "$APP"
for image in apps/sync/desktop/dist/*.dmg; do hdiutil verify "$image"; done
- uses: actions/upload-artifact@v4
with:
name: SyncLive-${{ runner.os }}-${{ runner.arch }}
path: apps/sync/desktop/dist/SyncLive-*
if-no-files-found: error
retention-days: 14

publish:
needs: [desktop]
if: ${{ !cancelled() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: SyncLive-*
path: dist
merge-multiple: true
- name: Publish the apps to the apps release
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
cd dist
FILES=""
for name in SyncLive-Windows-Setup.exe SyncLive-Windows-Portable.zip \
SyncLive-macOS-AppleSilicon.dmg SyncLive-macOS-Intel.dmg; do
if [ -f "$name" ]; then
FILES="$FILES $name"
else
echo "::warning::$name was not built in this run; the release keeps its previous copy (if any)."
fi
done
if [ -z "$FILES" ]; then
echo "::error::No app passed its checks."
exit 1
fi
sha256sum $FILES > SHA256SUMS.txt
cat SHA256SUMS.txt
cat > notes.md <<'EOF'
**Sync**: listen to music together, live. The apps open the same Sync as https://juw12.github.io/projects/sync/ in their own window.

| Your device | Download | How to install |
| --- | --- | --- |
| **Windows 10/11** | [SyncLive-Windows-Setup.exe](https://github.com/juw12/projects/releases/download/sync-desktop/SyncLive-Windows-Setup.exe) | Open it and press Install (no admin needed). If Windows says it protected your PC, choose **More info → Run anyway** (the app is not code-signed yet). Without installing: [SyncLive-Windows-Portable.zip](https://github.com/juw12/projects/releases/download/sync-desktop/SyncLive-Windows-Portable.zip). |
| **Mac with Apple chip (M1 and newer)** | [SyncLive-macOS-AppleSilicon.dmg](https://github.com/juw12/projects/releases/download/sync-desktop/SyncLive-macOS-AppleSilicon.dmg) | Open it and drag SyncLive to Applications. The first time, macOS blocks it because it is not notarized: **System Settings → Privacy & Security → Open Anyway**. |
| **Mac with Intel chip** | [SyncLive-macOS-Intel.dmg](https://github.com/juw12/projects/releases/download/sync-desktop/SyncLive-macOS-Intel.dmg) | Same as above. Not sure which Mac? Apple menu → About This Mac shows **Chip** (Apple) or **Processor** (Intel). |
| **iPhone / iPad** | [Open in Safari](https://juw12.github.io/projects/sync/) | Share → **Add to Home Screen** (free, full screen, updates itself). |
| **Android** | [sync-mobile release](https://github.com/juw12/projects/releases/tag/sync-mobile) | Download the .apk and allow your browser to install it. |

The apps load SyncLive from the web, so new versions arrive the moment they are published, with no reinstall. Checksums for this build: `SHA256SUMS.txt`.
EOF
{
echo
echo "Built from ${GITHUB_SHA::7}."
} >> notes.md
if gh release view sync-desktop --repo "$REPO" > /dev/null 2>&1; then
gh release upload sync-desktop $FILES SHA256SUMS.txt --clobber --repo "$REPO"
gh release edit sync-desktop --notes-file notes.md --repo "$REPO"
else
gh release create sync-desktop $FILES SHA256SUMS.txt --title "Sync for Windows and Mac" \
--notes-file notes.md --latest=false --repo "$REPO"
fi
Loading
Loading