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
@@ -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