Skip to content

Commit 8e662fc

Browse files
feat(core): Record release channel in script
1 parent 66a0449 commit 8e662fc

File tree

7 files changed

+13
-2
lines changed

7 files changed

+13
-2
lines changed

.github/workflows/container.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111

1212
env:
1313
DEV_BUILD: ${{ github.ref_name == 'main' }}
14-
REGISTRY: ghcr.io
1514
IMAGE_NAME: ${{ github.repository }}
15+
KS_RELEASE_CHANNEL: fixed
16+
REGISTRY: ghcr.io
1617

1718
jobs:
1819
build-and-push-image:

.github/workflows/userscript-nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
workflow_dispatch:
99

1010
env:
11+
KS_RELEASE_CHANNEL: nightly
1112
NIGHTLY_BUILD: true
1213

1314
jobs:

.github/workflows/userscript-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
env:
1111
DEV_BUILD: true
12+
KS_RELEASE_CHANNEL: dev
1213

1314
jobs:
1415
pre-release:

.github/workflows/userscript-tagged-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
env:
99
DEV_BUILD: false
10+
KS_RELEASE_CHANNEL: stable
1011

1112
jobs:
1213
tagged-release:

packages/userscript/source/UserScript.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import { GamePage } from "./types";
1111
import { UserInterface } from "./ui/UserInterface";
1212

1313
declare global {
14-
const KS_VERSION: string | null;
14+
const KS_RELEASE_CHANNEL: "dev" | "fixed" | "nightly" | "stable";
15+
const KS_VERSION: string | undefined;
16+
1517
let unsafeWindow: Window | undefined;
1618
interface Window {
1719
$: JQuery;
@@ -79,6 +81,7 @@ export class UserScript {
7981
language: SupportedLanguages = DefaultLanguage
8082
) {
8183
cinfo(`Kitten Scientists ${ksVersion("v")} constructed.`);
84+
cinfo(`You are on the '${KS_RELEASE_CHANNEL}' release channel.`);
8285

8386
this.gamePage = gamePage;
8487
this.i18nEngine = i18nEngine;

packages/userscript/vite.config.inject.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import manifest from "./package.json" assert { type: "json" };
33

44
const filename = "kitten-scientists.inject.js";
55

6+
const KS_RELEASE_CHANNEL = JSON.stringify(process.env.KS_RELEASE_CHANNEL ?? "fixed");
67
const KS_VERSION = JSON.stringify(process.env.KS_VERSION ?? `${manifest.version}-live`);
78

89
export default defineConfig({
@@ -23,6 +24,7 @@ export default defineConfig({
2324
sourcemap: "inline",
2425
},
2526
define: {
27+
KS_RELEASE_CHANNEL,
2628
KS_VERSION,
2729
},
2830
});

packages/userscript/vite.config.userscript.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const filename = ["kitten-scientists", `-${versionString}`, minify ? ".min" : ""
2828
""
2929
);
3030

31+
const KS_RELEASE_CHANNEL = JSON.stringify(process.env.KS_RELEASE_CHANNEL ?? "fixed");
3132
const KS_VERSION = JSON.stringify(versionString);
3233

3334
export default defineConfig({
@@ -58,6 +59,7 @@ export default defineConfig({
5859
},
5960
},
6061
define: {
62+
KS_RELEASE_CHANNEL,
6163
KS_VERSION,
6264
},
6365
});

0 commit comments

Comments
 (0)