Files
Piik/docs/operations/github.md
T
AAA 4ff970f483 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.
2026-09-12 23:01:48 +08:00

97 lines
5.5 KiB
Markdown

# GitHub Repository And Releases
[Versioning](../reference/versioning.md) owns release meaning and compatibility;
[CONTRIBUTING](../../CONTRIBUTING.md) owns review and local validation. This file
owns the one-time GitHub settings. The source repository is public; automatic
package publication has its own activation gate below.
## Main And Pull Requests
Use squash merging only, with the PR title and body as the squash commit. These
repository settings are applied. Keep automatic branch deletion off: the normal
cleanup step checks local worktrees and remaining references first.
Protect `main` with PRs required, zero mandatory peer approvals for the solo
maintainer, administrator enforcement, linear history, and no force pushes or
deletions. Do not require cloud PR checks while branch/PR CI is intentionally
quiet; local validation and acceptance precede the squash merge. PR/issue
templates live in `.github/`; [naming](../../CONTRIBUTING.md#commit-pr-and-branch-names)
is shared with automatic version selection.
These protections are active, including conversation resolution. GitHub Pages
uses the **GitHub Actions** publishing source and the `piik.tv` custom domain;
the repository homepage points to `https://piik.tv`. The dedicated Website
workflow publishes the static site under [website operations](./website.md).
## Enable Automatic Publication Once
Before enabling, accept the release packages, compatibility baseline, public
copy and repository visibility; finish main protection. Then set repository
Actions variable `PIIK_RELEASES_ENABLED` to `true`. This is a repository setting,
not an environment variable for Piik App or Server.
Subsequent accepted PRs merged to main use the existing CI workflow. Product
changes calculate one version, validate, package Server and all App targets,
and publish the same artifacts. Standalone website/docs changes validate without
packaging or releasing; [versioning](../reference/versioning.md#automatic-publication)
owns that boundary. Runs queue rather than overlap or cancel one another. Branches/PRs
stay quiet; manual `client_checks` dispatch remains available for candidates.
Writing a new version back to main is unnecessary and prohibited.
For a complete publisher rehearsal, dispatch with `client_checks: true` and an
explicit `candidate_version` such as `v1.0.0`. This builds genuine Server and
native App artifacts under one revision and version without tagging or
publishing. Prepare its [release-note section](../reference/versioning.md#release-notes)
and inspect the generated preview in the run summary. For a local preview, run
`node scripts/release-notes.mjs v1.0.0 FULL_SOURCE_SHA` from the checkout with
full history and tags. Download that run's artifacts and pass their directory, version and
full revision to `scripts/publish-release.mjs --dry-run` (put the flag after
the three positional arguments). An omitted candidate version keeps the usual
development/exact-tag identity.
Enable GitHub's built-in release immutability for formal publication where
available. Upload all assets to the draft before publishing. A failed upload can
resume its same-source draft; a published version is never clobbered. If its
files are wrong or incomplete, publish a corrected new version. An older retry
must not replace a newer release's `latest` designation.
To stop future automatic publication, remove/set false the activation variable;
this does not alter existing releases or a currently running workflow. Inspect
the active run separately. No pipeline step changes visibility or installs an
update into a running Piik deployment.
## Gitee Download Mirror
[TNTcraftHIM/Piik](https://gitee.com/TNTcraftHIM/Piik) is a public README/Release
mirror. Source, documentation and issues stay on GitHub. The publishing job uses
the repository Actions secret `GITEE_TOKEN`, which is configured; rotate it there
when needed. Never put it in source, a remote URL or a distributed package.
GitHub publication continues to use the workflow's scoped token.
After GitHub publication, the same job runs `scripts/mirror-release.mjs` on the
original artifacts. Upload failure leaves the Gitee release marked as a preview.
Rerun the failed publishing job to verify existing files and upload only missing
ones. GitHub's published release remains unchanged. Both publishers reject
changing a published package; use a corrected new version if its bytes are wrong.
If the original Actions artifacts have expired, download that release's files
from GitHub into an external working directory, then run:
```sh
gh release download v1.0.0 --repo TNTcraftHIM/Piik --dir /tmp/piik-mirror
node scripts/mirror-release.mjs /tmp/piik-mirror v1.0.0 FULL_SOURCE_SHA
```
Use the release's actual version and full `target_commitish` SHA, with
`GITEE_TOKEN` supplied through the publisher environment. `--dry-run` after the
three arguments checks local identity, checksums and attachment sizes without
publishing. The [release-source policy](../reference/versioning.md#release-sources)
owns provenance, selection and quota limits. The first public release passed
complete matching Server and three-platform App mirror download acceptance.
## Platform References
- [Protected branch availability](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)
- [Workflow concurrency and queued runs](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-queueing-multiple-pending-runs)
- [Immutable release workflow](https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases)