From cef88c8a7f034a44a5a38ac234ee9aa6b3494d6c Mon Sep 17 00:00:00 2001 From: Lulu Date: Wed, 5 Aug 2026 14:23:19 +0800 Subject: [PATCH] refactor(stage-tamagotchi): require Steam app id env and generate steam_appid.txt --- .github/workflows/release-tamagotchi-steam.yml | 2 ++ .gitignore | 1 + .../scripts/pack-steam-redistributables.ts | 11 +++++++---- apps/stage-tamagotchi/steam_appid.txt | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 apps/stage-tamagotchi/steam_appid.txt diff --git a/.github/workflows/release-tamagotchi-steam.yml b/.github/workflows/release-tamagotchi-steam.yml index 4bc439438..2634d1633 100644 --- a/.github/workflows/release-tamagotchi-steam.yml +++ b/.github/workflows/release-tamagotchi-steam.yml @@ -35,6 +35,8 @@ jobs: runs-on: ${{ matrix.os }} env: VITE_DISTRIBUTION: steam + VITE_STEAM_APP_ID: '3885340' + STEAM_APP_ID: '3885340' VITE_DISABLE_CUSTOM_PROVIDERS: 'true' VITE_DISABLE_FLUX_PURCHASE: 'true' VITE_ENABLE_POSTHOG: 'false' diff --git a/.gitignore b/.gitignore index 95c390614..d9afab408 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ coverage/ # Steamworks SDK (download from Steamworks partner site; not redistributable in git) apps/stage-tamagotchi/steamworks_sdk/ +apps/stage-tamagotchi/steam_appid.txt # Build out/ diff --git a/apps/stage-tamagotchi/scripts/pack-steam-redistributables.ts b/apps/stage-tamagotchi/scripts/pack-steam-redistributables.ts index 467f096cb..9015ad36a 100644 --- a/apps/stage-tamagotchi/scripts/pack-steam-redistributables.ts +++ b/apps/stage-tamagotchi/scripts/pack-steam-redistributables.ts @@ -28,10 +28,10 @@ import { errorMessageFrom } from '@moeru/std' import { ofetch } from 'ofetch' // NOTICE: -// Default must stay in sync with apps/stage-tamagotchi/steam_appid.txt and the -// VITE_STEAM_APP_ID fallback in services/steam/client.ts. STEAM_APP_ID lets CI -// override the app id without changing the committed dev file. -const STEAM_APP_ID = process.env.STEAM_APP_ID?.trim() || '3885340' +// Required in CI and local packaging; the same value is exposed to the client +// build as VITE_STEAM_APP_ID and to the server as STEAM_APP_ID. steam_appid.txt +// is generated by packSteamRedistributables, so it is not committed. +const STEAM_APP_ID = process.env.STEAM_APP_ID?.trim() // NOTICE: // Temporary CI fallback is the public rlabrecque/SteamworksSDK mirror (Valve copyright). @@ -71,6 +71,9 @@ export async function packSteamRedistributables( platform: SteamRedistributablePlatform, destDir: string, ): Promise { + if (!STEAM_APP_ID) + throw new Error('STEAM_APP_ID environment variable is required') + const relativePath = redistributables[platform] // Resolve so relative dests are anchored to process.cwd() (pnpm -F exec uses the diff --git a/apps/stage-tamagotchi/steam_appid.txt b/apps/stage-tamagotchi/steam_appid.txt deleted file mode 100644 index 4261998b0..000000000 --- a/apps/stage-tamagotchi/steam_appid.txt +++ /dev/null @@ -1 +0,0 @@ -3885340