fix(website): simplify downloads and scope product releases (#390)
## Problem and outcome Website visitors can download the usual Windows x64, macOS Apple silicon and Linux x64 App packages directly from clearly labeled platform cards. Each card includes a verified Gitee alternative, with shared setup guidance and a More downloads link for the full release list. The homepage reuses the application's 20 bilingual greetings, and the sample game no longer displays an invented title. Website builds resolve links from the latest published GitHub release and validate matching mirror assets. Website deployment follows main CI so newly published packages reach the next site build. Version selection and release notes now share a product-change filter: standalone website, documentation and maintenance changes do not create App/Server releases or affect the next product version. ## Verification - `npm run check`: 57 test files / 759 tests, TypeScript and product production build passed. - Website build passed with real GitHub/Gitee v1.0.0 metadata and with the explicit local fallback. - English and Chinese browser checks at 390px and 1440px passed: platform links, More downloads, greeting selection and language switching. - All 23 website film check groups passed; the final shared artwork change rebuilt successfully. - Documentation, repository hygiene and diff checks passed. Real Git-history tests cover product/website mixtures and moves across the release boundary; the accepted phase plans `publish: false`. ## Impact GitHub remains the version authority; Gitee is a download mirror. Unavailable mirror metadata falls back to its release page. Product runtime behavior and package compatibility are unchanged. Physical macOS/Linux capture and broader device/network limits remain documented.
This commit is contained in:
24 files changed
+429
-157
No files matched your search
@@ -6,7 +6,7 @@
|
||||
|
||||
## Release notes
|
||||
|
||||
<!-- Public copy, automatically published in GitHub Releases. Keep this exact heading; use ### for subsections. Describe user benefits, fixes and any required upgrade action in concise Chinese and English. Omit internal logs, audit prompts and unverified claims. 更新说明将直接公开:写清用户可感知的变化与升级事项,提供简洁的中英文文案。首次发布介绍当前产品,不罗列内部开发历史。 -->
|
||||
<!-- Required for product-changing PRs; omit this section for standalone website/docs/maintenance work. Public copy, automatically published in GitHub Releases. Keep this exact heading; use ### for subsections. Describe user benefits, fixes and required upgrade actions in concise Chinese and English. Omit internal logs, audit prompts and unverified claims. 产品改动需填写公开的中英文更新说明;仅官网、文档或外围维护可删去此节。 -->
|
||||
|
||||
## Verification / 验证
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
name: Website
|
||||
|
||||
on:
|
||||
# Wait for CI/packaging to settle so new downloads reach the same site build.
|
||||
workflow_run:
|
||||
workflows: [CI]
|
||||
types: [completed]
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -12,7 +18,9 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
if: >-
|
||||
github.ref == 'refs/heads/main' &&
|
||||
(github.event_name == 'workflow_dispatch' || github.event.workflow_run.event == 'push')
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
@@ -24,12 +32,42 @@ jobs:
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: main
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- name: Read published downloads
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PIIK_WEBSITE_RELEASE_DATA: ${{ runner.temp }}/website-release.json
|
||||
run: |
|
||||
node --input-type=module <<'JS'
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
const repository = 'TNTcraftHIM/Piik';
|
||||
const github = JSON.parse(execFileSync('gh', ['api', `repos/${repository}/releases/latest`], { encoding: 'utf8' }));
|
||||
let mirror = null;
|
||||
try {
|
||||
const api = `https://gitee.com/api/v5/repos/${repository}`;
|
||||
const read = async path => {
|
||||
const response = await fetch(api + path, { signal: AbortSignal.timeout(20000) });
|
||||
if (!response.ok) throw new Error(`Mirror metadata: HTTP ${response.status}`);
|
||||
return response.json();
|
||||
};
|
||||
const release = await read(`/releases/tags/${encodeURIComponent(github.tag_name)}`);
|
||||
if (!Number.isSafeInteger(release.id) || release.id <= 0) throw new Error('Invalid mirror release ID');
|
||||
mirror = { ...release, assets: await read(`/releases/${release.id}/attach_files?per_page=100`) };
|
||||
} catch {
|
||||
console.log('Mirror metadata unavailable; keeping the mirror release-page link.');
|
||||
}
|
||||
writeFileSync(process.env.PIIK_WEBSITE_RELEASE_DATA, JSON.stringify({ github, mirror }));
|
||||
JS
|
||||
- run: npm run build:website
|
||||
env:
|
||||
PIIK_WEBSITE_RELEASE_DATA: ${{ runner.temp }}/website-release.json
|
||||
- uses: actions/configure-pages@v5
|
||||
- uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
|
||||
Reference in new issue
Block a user