diff --git a/.github/workflows/averages.yml b/.github/workflows/averages.yml deleted file mode 100644 index 0d72fc263..000000000 --- a/.github/workflows/averages.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Averages - -on: - workflow_dispatch: - schedule: - - cron: "0 8 * * *" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }} - PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} - PUBLIC_ASSET_FAST_USER: ${{ secrets.PUBLIC_ASSET_FAST_USER }} - PUBLIC_ASSET_FAST_REPO: ${{ secrets.PUBLIC_ASSET_FAST_REPO }} - PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} - ALLOW_ROBOTS: "true" - WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} - PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} - PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }} - GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }} - WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }} - PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} - PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} - PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v6 - with: - submodules: recursive - token: ${{ secrets.GH_TOKEN }} - - uses: oven-sh/setup-bun@v2 - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GH_TOKEN }} - - run: bun run setup - - - name: Build averages - env: - PUBLIC_ASSET_BRANCH: main - DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }} - - DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} - DATABASE_URL: ${{ secrets.DATABASE_URL }} - VIDEOS_SHEET: ${{ secrets.VIDEOS_SHEET }} - GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - - run: bun run build:averages --production diff --git a/.github/workflows/reviews.yml b/.github/workflows/reviews.yml deleted file mode 100644 index efc7bb923..000000000 --- a/.github/workflows/reviews.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Reviews - -on: - workflow_dispatch: - schedule: - - cron: 0 0 * * 2 - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} - DATABASE_URL: ${{ secrets.DATABASE_URL }} - PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }} - PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }} - GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v6 - with: - submodules: recursive - token: ${{ secrets.GH_TOKEN }} - - uses: oven-sh/setup-bun@v2 - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GH_TOKEN }} - - run: bun run setup - - - name: Find reviews - run: bun run build:reviews diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index a5577f154..ca11f5914 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -31,10 +31,8 @@ concurrency: cancel-in-progress: true env: - PUBLIC_ENVIRONMENT: ${{ inputs.environment || 'beta' }} - # blitzkit - PUBLIC_BRANCH: main + PUBLIC_ENVIRONMENT: ${{ inputs.environment || 'beta' }} PUBLIC_PROMOTE_OPENTEST: false PUBLIC_STATIC_ASSET_BASE: https://assets.blitzkit.app PUBLIC_GUIDE_WEBSITE: https://guidesblitz.com diff --git a/README.md b/README.md index a3c6446fd..15581e128 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,6 @@ If you intend to contribute to the code, note that you may need to check out sen | `GOOGLE_APPLICATION_CREDENTIALS` | [Google Cloud](https://cloud.google.com/) | | Google Cloud's API key, primarily used for ranking popular tanks and finding relevant tank review videos in Tankopedia. | | `PUBLIC_DISCORD_SERVER_ID` | [BlitzKit Discord Server](https://discord.gg/nDt7AjGJQH) | `734786591205359697` | BlitzKit Discord Server's id. | | `PUBLIC_ASSET_BASE` | [blitzkit/assets](https://github.com/blitzkit/assets) | `https://blitzkit.github.io/assets` | The root domain and path that serves the external assets like tank models and icons. | -| `PUBLIC_BRANCH` | | `main` | The branch that the website is operating on. This is completely nominal. | | `PUBLIC_GUIDE_WEBSITE` | [GuidesBlitz](https://guidesblitz.com/) | `https://guidesblitz.com` | The website that serves the encyclopedia-like content in BlitzKit. | | `SERVICING` | | `false` | Wether the website is down for servicing. | | `GH_TOKEN` | [GitHub Fine-Grained Tokens](https://github.com/settings/personal-access-tokens) | | The GitHub API key used for checking out private submodules and pushing content to the asset repository. | diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index 070868b14..534e2fa8d 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -43,10 +43,11 @@ }, "branches": { - "local": "dev", - "dev": "beta", - "opentest": "opentest", - "preview": "preview" + "beta": "Beta", + "development": "Development", + "opentest": "OpenTest", + "preview": "Preview", + "production": "Production" }, "locales": { diff --git a/packages/website/src/components/Footer.astro b/packages/website/src/components/Footer.astro index ec9e7c750..3bcd19c6c 100644 --- a/packages/website/src/components/Footer.astro +++ b/packages/website/src/components/Footer.astro @@ -12,7 +12,7 @@ export interface Props { } const gameDefinitions = await api.gameDefinitions(); -const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_BRANCH); +const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT); const { locale } = Astro.props; const strings = getStrings(locale); --- @@ -135,7 +135,7 @@ const strings = getStrings(locale); BlitzKit { - PUBLIC_ASSET_BRANCH !== "preview" && ( + environment !== "preview" && ( WoTB @@ -149,14 +149,14 @@ const strings = getStrings(locale); {packageJson.version} { - PUBLIC_ASSET_BRANCH !== "preview" && ( + environment !== "preview" && ( {gameDefinitions.version} ) } - {PUBLIC_ASSET_BRANCH} + {environment} @@ -168,7 +168,7 @@ const strings = getStrings(locale); { - PUBLIC_ASSET_BRANCH !== "preview" && ( + environment !== "preview" && ( <> WoTB @@ -182,7 +182,7 @@ const strings = getStrings(locale); CDN - {PUBLIC_ASSET_BRANCH} + {environment} diff --git a/packages/website/src/components/Plugs.tsx b/packages/website/src/components/Plugs.tsx index f5c4d838b..9322fcc6b 100644 --- a/packages/website/src/components/Plugs.tsx +++ b/packages/website/src/components/Plugs.tsx @@ -5,7 +5,7 @@ import { Button, Code, Flex, Link, Text } from "@radix-ui/themes"; export function Plugs() { const promoteOpentest = assertSecret(import.meta.env.PUBLIC_PROMOTE_OPENTEST) === "true" && - assertSecret(import.meta.env.PUBLIC_BRANCH) !== "opentest"; + assertSecret(import.meta.env.PUBLIC_ENVIRONMENT) !== "opentest"; const promotions = [promoteOpentest]; if (promotions.every((promotion) => !promotion)) return null; diff --git a/packages/website/src/components/Tankopedia/CalloutsSection.tsx b/packages/website/src/components/Tankopedia/CalloutsSection.tsx index ac10eaf67..b3e2d5b39 100644 --- a/packages/website/src/components/Tankopedia/CalloutsSection.tsx +++ b/packages/website/src/components/Tankopedia/CalloutsSection.tsx @@ -15,7 +15,7 @@ const tankDefinitions = await api.tankDefinitions(); export function CalloutsSection() { const tank = Duel.use((state) => state.protagonist.tank); const promoteAeson = - assertSecret(import.meta.env.PUBLIC_BRANCH) === "preview"; + assertSecret(import.meta.env.PUBLIC_ENVIRONMENT) === "preview"; useEffect(() => { TankopediaPersistent.mutate((draft) => { diff --git a/packages/website/src/core/blitzkit/branches.ts b/packages/website/src/core/blitzkit/branches.ts index 1861f11c8..8f6f2ed77 100644 --- a/packages/website/src/core/blitzkit/branches.ts +++ b/packages/website/src/core/blitzkit/branches.ts @@ -3,19 +3,12 @@ import { STRINGS } from "@blitzkit/i18n"; import locales from "@blitzkit/i18n/locales.json"; export function resolveBranchName(locale: string = locales.default) { - if (!(locale in STRINGS)) throw new Error(`Unsupported locale: ${locale}`); - const strings = STRINGS[locale]; - const secret = assertSecret(import.meta.env.PUBLIC_BRANCH); + const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT); - if ( - assertSecret(import.meta.env.MODE) === "development" && - secret === "dev" - ) { - return strings.common.branches.local; - } else { - return (strings.common.branches as Record)[secret] as - | string - | undefined; - } + if (environment === "production") return undefined; + + return strings.common.branches[ + environment as keyof typeof strings.common.branches + ]; } diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro b/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro index 2bda9a01e..1f43e7990 100644 --- a/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro +++ b/packages/website/src/pages/[...chunk_default]/[...locale]/index.astro @@ -16,7 +16,7 @@ import { getStaticPaths as _getStaticPaths } from "../_index"; const MAX_TOOLS_PER_ROW = 2; -const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_BRANCH); +const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT); const { locale } = Astro.props; const strings = getStrings(locale); const rows: Tool[][] = []; @@ -88,7 +88,7 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => { { - PUBLIC_ASSET_BRANCH === "preview" && ( + environment === "preview" && (