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
137 changes: 137 additions & 0 deletions .github/workflows/house-of-articles-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: HouseOfArticles Android app

# Builds HouseOfArticles-android.apk (apps/house-of-articles/android/: a full-screen window around the web app), signs it with the key in the
# repository's secrets, opens it on an emulator and puts it on the house-of-articles-android release.
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "apps/house-of-articles/android/**"
- ".github/workflows/house-of-articles-android.yml"
pull_request:
paths:
- "apps/house-of-articles/android/**"
- ".github/workflows/house-of-articles-android.yml"

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"

- name: "Build and sign the .apk (no Gradle: aapt2, javac, d8, zipalign, apksigner)"
env:
KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
run: |
tools=$(ls -d "$ANDROID_HOME"/build-tools/34.* 2>/dev/null | sort -V | tail -n 1)
if [ -z "$tools" ]; then tools=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -n 1); fi
platform="$ANDROID_HOME/platforms/android-34"
if [ ! -f "$platform/android.jar" ]; then platform=$(ls -d "$ANDROID_HOME"/platforms/android-* | sort -V | tail -n 1); fi
export ANDROID_BUILD_TOOLS="$tools" ANDROID_JAR="$platform/android.jar"
echo "build-tools: $tools, platform: $platform"
if [ -n "$KEYSTORE_B64" ]; then
echo "$KEYSTORE_B64" | base64 -d > "$RUNNER_TEMP/release.p12"
printf '%s' "$KEYSTORE_PASSWORD" > "$RUNNER_TEMP/release-password.txt"
python3 apps/house-of-articles/android/build.py --keystore "$RUNNER_TEMP/release.p12" --password-file "$RUNNER_TEMP/release-password.txt" --alias shells
echo "SIGNED=release" >> "$GITHUB_ENV"
else
echo "::warning::No signing key secret here (a pull request from a fork): signed with a throwaway key."
python3 apps/house-of-articles/android/build.py
echo "SIGNED=throwaway" >> "$GITHUB_ENV"
fi
echo "APKSIGNER=$tools/apksigner" >> "$GITHUB_ENV"

- name: The certificate is the one app.json names
if: env.SIGNED == 'release'
run: |
expected=$(python3 -c "import json; print(json.load(open('apps/house-of-articles/android/app.json'))['certSha256'])")
found=$("$APKSIGNER" verify --print-certs apps/house-of-articles/android/dist/HouseOfArticles-android.apk | sed -n 's/^Signer #1 certificate SHA-256 digest: //p')
echo "expected $expected"
echo "found $found"
[ "$expected" = "$found" ]
(cd apps/house-of-articles/android/dist && sha256sum HouseOfArticles-android.apk > HouseOfArticles-android.apk.sha256 && cat HouseOfArticles-android.apk.sha256)

- uses: actions/upload-artifact@v4
with:
name: houseofarticles-android
path: apps/house-of-articles/android/dist/
if-no-files-found: error

emulator:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: houseofarticles-android
path: apps/house-of-articles/android/dist
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Open the app on an emulator and check it stays up
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
disable-animations: true
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
script: python3 apps/house-of-articles/android/smoke.py apps/house-of-articles/android/dist/HouseOfArticles-android.apk
- uses: actions/upload-artifact@v4
if: always()
with:
name: houseofarticles-android-emulator-check
path: |
apps/house-of-articles/android/dist/*.png
apps/house-of-articles/android/dist/android-logcat.txt
retention-days: 7

publish:
needs: [build, emulator]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: houseofarticles-android
path: dist
# The house-of-articles-android release keeps one address for the download. The file there is replaced only when
# apps/house-of-articles/android/app.json names a new versionName, never by a rebuild of the same version.
- name: Put the .apk on the house-of-articles-android release
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(python3 -c "import json; print(json.load(open('apps/house-of-articles/android/app.json'))['versionName'])")
echo "$version" > dist/HouseOfArticles-android.version.txt
if ! gh release view house-of-articles-android --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then
printf '%s\n' "House of Articles for Android: a full-screen window around the web app (https://juw12.github.io/projects/house-of-articles/)." "" \
"Download [HouseOfArticles-android.apk](https://github.com/$GITHUB_REPOSITORY/releases/download/house-of-articles-android/HouseOfArticles-android.apk), open the file on the phone and allow \"install unknown apps\" for your browser once." \
"It is not from a store: Android asks before it installs." > notes.md
gh release create house-of-articles-android dist/HouseOfArticles-android.apk dist/HouseOfArticles-android.apk.sha256 dist/HouseOfArticles-android.version.txt \
--title "House of Articles for Android" --notes-file notes.md --latest=false --repo "$GITHUB_REPOSITORY"
echo "Made the house-of-articles-android release with HouseOfArticles-android.apk $version"
exit 0
fi
published=$(gh release download house-of-articles-android --repo "$GITHUB_REPOSITORY" --pattern HouseOfArticles-android.version.txt --output - 2>/dev/null || true)
if [ "$published" = "$version" ]; then
echo "the house-of-articles-android release already has HouseOfArticles-android.apk $version"
exit 0
fi
gh release upload house-of-articles-android dist/HouseOfArticles-android.apk dist/HouseOfArticles-android.apk.sha256 dist/HouseOfArticles-android.version.txt --clobber --repo "$GITHUB_REPOSITORY"
echo "HouseOfArticles-android.apk on the house-of-articles-android release is now $version (was: ${published:-none})"
177 changes: 177 additions & 0 deletions .github/workflows/house-of-articles-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
name: HouseOfArticles apps

# Builds the downloadable HouseOfArticles apps and publishes them to the "house-of-articles-desktop" release from main:
# Windows HouseOfArticles-Windows-Setup.exe (per-user installer) + HouseOfArticles-Windows-Portable.zip
# macOS HouseOfArticles-macOS-AppleSilicon.dmg + HouseOfArticles-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/house-of-articles/desktop/**'
- '.github/workflows/house-of-articles-desktop.yml'
pull_request:
paths:
- 'apps/house-of-articles/desktop/**'
- '.github/workflows/house-of-articles-desktop.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: house-of-articles-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/house-of-articles/desktop/build.py --require-installer
- name: Open the built app and check its window shows this commit's HouseOfArticles
run: python apps/house-of-articles/desktop/smoke_test.py --built --local-site
- name: Install with HouseOfArticles-Windows-Setup.exe, run it, uninstall it
if: runner.os == 'Windows'
shell: pwsh
run: |
$setup = Resolve-Path 'apps/house-of-articles/desktop/dist/HouseOfArticles-Windows-Setup.exe'
$log = Join-Path $env:RUNNER_TEMP 'houseofarticles-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\HouseOfArticles\HouseOfArticles.exe'
if (-not (Test-Path $app)) { throw "HouseOfArticles.exe was not installed to $app" }
$shortcuts = @(
(Join-Path ([Environment]::GetFolderPath('Programs')) 'HouseOfArticles.lnk'),
(Join-Path ([Environment]::GetFolderPath('Desktop')) 'HouseOfArticles.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 'HouseOfArticles'
if (-not $entry) { throw 'HouseOfArticles is missing from Settings > Apps' }
python apps/house-of-articles/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 HouseOfArticles.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/house-of-articles/desktop/dist/HouseOfArticles.app
test "$(plutil -extract CFBundleIdentifier raw "$APP/Contents/Info.plist")" = "io.github.juw12.houseofarticles.desktop"
test "$(plutil -extract CFBundleShortVersionString raw "$APP/Contents/Info.plist")" = "$(python3 -c 'import json; print(json.load(open("apps/house-of-articles/desktop/shell.json"))["version"])')"
echo "Architecture: $(lipo -archs "$APP/Contents/MacOS/HouseOfArticles")"
codesign --verify --deep --verbose=2 "$APP"
for image in apps/house-of-articles/desktop/dist/*.dmg; do hdiutil verify "$image"; done
- uses: actions/upload-artifact@v4
with:
name: HouseOfArticles-${{ runner.os }}-${{ runner.arch }}
path: apps/house-of-articles/desktop/dist/HouseOfArticles-*
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: HouseOfArticles-*
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 HouseOfArticles-Windows-Setup.exe HouseOfArticles-Windows-Portable.zip \
HouseOfArticles-macOS-AppleSilicon.dmg HouseOfArticles-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'
**House of Articles**: athlete-moment sneaker news plus a live resale market feed. The apps open the same House of Articles as https://juw12.github.io/projects/house-of-articles/ in their own window.

| Your device | Download | How to install |
| --- | --- | --- |
| **Windows 10/11** | [HouseOfArticles-Windows-Setup.exe](https://github.com/juw12/projects/releases/download/house-of-articles-desktop/HouseOfArticles-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: [HouseOfArticles-Windows-Portable.zip](https://github.com/juw12/projects/releases/download/house-of-articles-desktop/HouseOfArticles-Windows-Portable.zip). |
| **Mac with Apple chip (M1 and newer)** | [HouseOfArticles-macOS-AppleSilicon.dmg](https://github.com/juw12/projects/releases/download/house-of-articles-desktop/HouseOfArticles-macOS-AppleSilicon.dmg) | Open it and drag HouseOfArticles to Applications. The first time, macOS blocks it because it is not notarized: **System Settings → Privacy & Security → Open Anyway**. |
| **Mac with Intel chip** | [HouseOfArticles-macOS-Intel.dmg](https://github.com/juw12/projects/releases/download/house-of-articles-desktop/HouseOfArticles-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/house-of-articles/) | Share → **Add to Home Screen** (free, full screen, updates itself). |
| **Android** | [HouseOfArticles-android.apk](https://github.com/juw12/projects/releases/download/house-of-articles-android/HouseOfArticles-android.apk) | Open the file on the phone and allow your browser to install apps once. |

The apps load HouseOfArticles 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 house-of-articles-desktop --repo "$REPO" > /dev/null 2>&1; then
gh release upload house-of-articles-desktop $FILES SHA256SUMS.txt --clobber --repo "$REPO"
gh release edit house-of-articles-desktop --notes-file notes.md --repo "$REPO"
else
gh release create house-of-articles-desktop $FILES SHA256SUMS.txt --title "House of Articles for Windows and Mac" \
--notes-file notes.md --latest=false --repo "$REPO"
fi
Loading
Loading