mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2026-08-12 17:40:32 +00:00
95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
name: PWA Store Build
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ["main"]
|
|
paths:
|
|
- ".github/workflows/store-pwa.yml"
|
|
- "index.html"
|
|
- "package.json"
|
|
- "pnpm-lock.yaml"
|
|
- "public/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "vite.config.mjs"
|
|
workflow_dispatch:
|
|
inputs:
|
|
production_url:
|
|
description: "Public HTTPS URL used for Microsoft Store/PWABuilder submission"
|
|
required: true
|
|
default: "https://cs.houlang.cloud/"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: pwa-store-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-validate:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VITE_APP_ID: d158067f53627d2b98babe8bffd2fd7d
|
|
VITE_DEFAULT_KV_SERVER: https://kv-service.houlang.cloud
|
|
VITE_DEFAULT_AUTH_SERVER: https://kv.houlang.cloud
|
|
STORE_PRODUCTION_URL: ${{ inputs.production_url || 'https://cs.houlang.cloud/' }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Enable Corepack
|
|
run: corepack enable
|
|
|
|
- name: Use Node.js 24
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24.x"
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build and validate PWA
|
|
run: pnpm run build:store
|
|
|
|
- name: Create store handoff metadata
|
|
run: |
|
|
node <<'NODE'
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const url = process.env.STORE_PRODUCTION_URL;
|
|
const handoffDir = path.resolve('store-handoff');
|
|
fs.mkdirSync(handoffDir, { recursive: true });
|
|
fs.writeFileSync(
|
|
path.join(handoffDir, 'microsoft-store-pwa.json'),
|
|
JSON.stringify({
|
|
productionUrl: url,
|
|
manifestUrl: new URL('manifest.webmanifest', url).toString(),
|
|
packageSource: 'Use PWABuilder or Microsoft Partner Center with the production URL above.',
|
|
validationArtifact: 'dist/',
|
|
notes: [
|
|
'Serve the app over HTTPS before packaging.',
|
|
'Run this workflow after changing manifest, icons, service worker, or public assets.',
|
|
'Partner Center listing screenshots, age rating, privacy policy, and publisher identity are handled outside this repository.'
|
|
]
|
|
}, null, 2)
|
|
);
|
|
NODE
|
|
|
|
- name: Upload validated PWA dist
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: classworks-pwa-dist
|
|
path: dist
|
|
if-no-files-found: error
|
|
|
|
- name: Upload Microsoft Store handoff
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: microsoft-store-handoff
|
|
path: store-handoff
|
|
if-no-files-found: error
|