Files
Dylan M. Taylor 16141903a3 feat(linux-repos): support -nightly packages pointing at latest nightly releases (#418)
## Summary

Add support for `<app>-nightly` packages across the APT (`/apt`), RPM
(`/rpm`), and Arch (`/arch`) Linux repositories in
`artcraft-website-next`, always pointing at the newest published nightly
GitHub prerelease per repository regardless of its release tag.

## Changes

- **`crafting-app-releases.ts`**: Add `CraftNightlyRelease` and
`CRAFT_NIGHTLY_RELEASES` (initially `{}`).
- **`linux-repos.ts`**:
- Resolve `<pkg>-nightly-<version>-linux-<arch>.{deb,rpm,pkg.tar.zst}`
(and `.sig`/`.asc` signatures) against `CRAFT_NIGHTLY_RELEASES` using
each entry's exact GitHub release `tag`.
- Support `tagOverride` in `getShaSums`, `fetchValidatedSha256`,
`computePackageMetadata`, `durablePackageMetadata`,
`getLinuxPackageMetadata`, and `build{Deb,Rpm,Arch}Assets`.
- Emit `<app>-nightly` packages in `getLinuxRepoApps` (with
`ai.artcraft.app-nightly` / `ai.storyteller.<app>-nightly` for Pacman so
they install alongside stable).
- **`update-craft-release-versions.yml`**: Add a `latestNightlyRelease`
pass that scans each repo's published `prerelease: true` GitHub releases
(newest first, regardless of tag format) for `SHA256SUMS.txt` and
`<slug>-nightly-...` Linux packages, and updates
`CRAFT_NIGHTLY_RELEASES`.
- **`tests/linux-repos.spec.ts`**: Add unit test coverage for resolving
`-nightly` Linux package and signature URLs regardless of GitHub release
tag.

## Verification

- `next typegen && npm run typecheck` passed.
- `npx playwright test tests/linux-repos.spec.ts`: 28/29 passed (the 1
browser-based mobile tab test failed locally due to missing
`/opt/google/chrome/chrome` in this environment).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Nightly Linux packages are available for ArtCraft Studio, Craft
Launcher, and supported Crafting Apps when a matching release is
published.
* Packages are offered in Debian, RPM, and Arch formats where available,
with release-specific versions and checksums. Supported package
architectures include x86_64 and aarch64, with riscv64 also supported
for Debian and RPM packages.
* The catalog reflects the newest published nightly release with
compatible package assets; products without a matching release are not
listed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 11:54:06 -05:00

90 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
#
# Build or deploy one of the Cloudflare-hosted frontends from the repository root.
#
# bash script/website/cloudflare_app.sh <build|deploy>
#
# Every Cloudflare Worker builds from this repository, and nothing in the Workers
# Builds environment names the project, so the app comes from ARTCRAFT_APP. The
# app-specific npm scripts set it inline and are the commands to configure:
#
# artcraft-website (default) getartcraft.com, root wrangler.jsonc
# npm run build:website / deploy:website
# artcraft-webapp app.getartcraft.com, frontend/apps/artcraft-webapp/wrangler.jsonc
# npm run build:webapp / deploy:webapp
# artcraft-dashboard dashboard.artcraft.team, frontend/apps/artcraft-dashboard/wrangler.jsonc
# npm run build:dashboard / deploy:dashboard
# storyteller-docs storyteller-docs.artcraft.team, frontend/api_docs/wrangler.jsonc
# npm run build:docs / deploy:docs
#
# The bare `npm run build` / `npm run deploy` pair falls back to the website and
# needs an ARTCRAFT_APP build variable. Only the website builds
# artcraft-website-next, so only it needs the website's build secrets
# (LAUNCHER_CATALOG_SIGNING_KEY, and the optional LINUX_SIGNING_KEY); the webapp
# and dashboard read neither.
set -euo pipefail
ACTION="${1:-}"
APP="${ARTCRAFT_APP:-artcraft-website}"
cd "$(dirname "$0")/../.."
WRANGLER_PREFIX=()
WRANGLER_CMD="deploy"
if [[ "${ACTION}" == "deploy" && -n "${WORKERS_CI_BRANCH:-}" && "${WORKERS_CI_BRANCH}" != "main" ]]; then
WRANGLER_PREFIX=(env -u WRANGLER_CI_MATCH_TAG)
WRANGLER_CMD="preview"
fi
case "${APP}:${ACTION}" in
artcraft-website:build)
npm --prefix frontend/apps/artcraft-website-next ci --ignore-scripts
npm --prefix frontend/apps/artcraft-website-next run build:cloudflare
;;
artcraft-website:deploy)
"${WRANGLER_PREFIX[@]}" npx --yes wrangler@4 ${WRANGLER_CMD}
;;
artcraft-webapp:build)
npm --prefix frontend ci --ignore-scripts
npm --prefix frontend run build:webapp
;;
artcraft-webapp:deploy)
"${WRANGLER_PREFIX[@]}" npx --yes wrangler@4 ${WRANGLER_CMD} --config frontend/apps/artcraft-webapp/wrangler.jsonc
;;
artcraft-dashboard:build)
# Standalone pnpm app outside the Nx/npm workspace; the script installs and
# builds inside its own folder.
bash frontend/apps/artcraft-dashboard/script/build_cloudflare.sh
;;
artcraft-dashboard:deploy)
"${WRANGLER_PREFIX[@]}" npx --yes wrangler@4 ${WRANGLER_CMD} --config frontend/apps/artcraft-dashboard/wrangler.jsonc
;;
storyteller-docs:build)
# The OpenAPI document comes from `cargo run --bin docs-cli`, which Workers
# Builds cannot run, so the artifacts are committed: this build only checks
# that they are present and that the document still parses.
for required in frontend/api_docs/public/index.html frontend/api_docs/public/api.json; do
if [[ ! -f "${required}" ]]; then
echo "Missing ${required}; regenerate with: bash script/build_api_docs.sh" >&2
exit 1
fi
done
node --input-type=module -e '
const { readFileSync } = await import("node:fs");
const spec = JSON.parse(readFileSync("frontend/api_docs/public/api.json", "utf8"));
const paths = Object.keys(spec.paths ?? {});
if (paths.length === 0) throw new Error("api.json contains no paths");
console.log(`api.json: ${paths.length} paths (${spec.info?.title ?? "untitled"})`);
'
;;
storyteller-docs:deploy)
"${WRANGLER_PREFIX[@]}" npx --yes wrangler@4 ${WRANGLER_CMD} --config frontend/api_docs/wrangler.jsonc
;;
*)
echo "Usage: ARTCRAFT_APP=<artcraft-website|artcraft-webapp|artcraft-dashboard|storyteller-docs> $0 <build|deploy>" >&2
echo "Got ARTCRAFT_APP='${APP}', action='${ACTION}'." >&2
exit 1
;;
esac