diff --git a/docs/next.config.js b/docs/next.config.js index 116fe8d5211d1f..de65ad6f342b8b 100644 --- a/docs/next.config.js +++ b/docs/next.config.js @@ -170,7 +170,11 @@ module.exports = withDocsInfra({ const prefix = userLanguage === 'en' ? '' : `/${userLanguage}`; pages2.forEach((page) => { - if (page.pathname.startsWith('/experiments') && process.env.DEPLOY_ENV !== 'production') { + // The experiments pages are only meant for experiments, they shouldn't leak to production. + if ( + (page.pathname.startsWith('/experiments/') || page.pathname === '/experiments') && + process.env.DEPLOY_ENV === 'production' + ) { return; } // The blog is not translated diff --git a/docs/nextConfigDocsInfra.js b/docs/nextConfigDocsInfra.js index 6b8271940508ff..296de19a2a0a5f 100644 --- a/docs/nextConfigDocsInfra.js +++ b/docs/nextConfigDocsInfra.js @@ -1,3 +1,14 @@ +/** + * See the docs of the Netlify environment variables: + * https://docs.netlify.com/configure-builds/environment-variables/#build-metadata. + * + * A few comments: + * - process.env.CONTEXT === 'production' means that the branch in Netlify was configured as production. + * For example, the `master` branch of the Core team is considered a `production` build on Netlify based + * on https://app.netlify.com/sites/material-ui/settings/deploys#branches. + * - Each team has different site https://app.netlify.com/teams/mui/sites. + * The following logic must be compatible with all of them. + */ let DEPLOY_ENV = 'development'; // Same as process.env.PULL_REQUEST_ID @@ -9,12 +20,16 @@ if (process.env.CONTEXT === 'production' || process.env.CONTEXT === 'branch-depl DEPLOY_ENV = 'production'; } +// The 'master' and 'next' branches are NEVER a production environment. We use these branches for staging. if ( - process.env.CONTEXT === 'branch-deploy' && + (process.env.CONTEXT === 'production' || process.env.CONTEXT === 'branch-deploy') && (process.env.HEAD === 'master' || process.env.HEAD === 'next') ) { DEPLOY_ENV = 'staging'; } +/** + * ==================================================================================== + */ process.env.DEPLOY_ENV = DEPLOY_ENV; diff --git a/docs/pages/experiments/index.js b/docs/pages/experiments/index.js index bac1aa877e6c4d..b16f134d1c0d74 100644 --- a/docs/pages/experiments/index.js +++ b/docs/pages/experiments/index.js @@ -56,13 +56,11 @@ export default function Experiments({ experiments }) {