From d2bdda9f5e3c056b6cf6be048fb2d0010451b3aa Mon Sep 17 00:00:00 2001 From: Vitor Ayres Date: Sun, 7 Apr 2024 18:53:15 -0300 Subject: [PATCH] improve build time on PR (#2048) * skip /releases in PR * experiment with BRANCH env * Revert "experiment with BRANCH env" This reverts commit 90036a210713f4ddfaa60ec87c5b403304c913e0. * experiment with HEAD env * use _redirects file * leave redirect commented * use context 'production' * fix netlify redirect * add notes about redirect files --- astro.config.mjs | 6 +++--- packages/releases-generator/build.ts | 6 +++++- public/_redirects | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 public/_redirects diff --git a/astro.config.mjs b/astro.config.mjs index e7a9eda77..3ed5fbfe8 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -358,9 +358,9 @@ export default defineConfig({ ...i18nRedirect('/v1/references/configuration-files', '/references/configuration-files'), ...i18nRedirect('/v1/references/webview-versions', '/references/webview-versions'), - // Decommissioned locales - '/ko/[...slug]': '/[...slug]', - '/it/[...slug]': '/[...slug]', + // Decommissioned locales -> refer to /public/_redirects file + // '/ko/[...slug]': '/[...slug]', + // '/it/[...slug]': '/[...slug]', }, // }); diff --git a/packages/releases-generator/build.ts b/packages/releases-generator/build.ts index 15a105707..774063cfd 100644 --- a/packages/releases-generator/build.ts +++ b/packages/releases-generator/build.ts @@ -190,4 +190,8 @@ function entitify(str: string): string { .replace(/\$\{/g, '$\\{'); } -generator(); +if (process.env.CONTEXT === 'production' || process.env.HEAD?.startsWith('release-pages')) { + generator(); +} else { + console.info('Skipping `/release` pages build'); +} diff --git a/public/_redirects b/public/_redirects new file mode 100644 index 000000000..a63f8205e --- /dev/null +++ b/public/_redirects @@ -0,0 +1,5 @@ +# Refer to astro.config.mjs + +# Decommissioned locales +/ko/* /:splat 302 +/it/* /:splat 302 \ No newline at end of file