Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[website] Exclude experiment pages in production #35180

Merged
merged 9 commits into from Nov 21, 2022
2 changes: 1 addition & 1 deletion docs/next.config.js
Expand Up @@ -170,7 +170,7 @@ module.exports = withDocsInfra({
const prefix = userLanguage === 'en' ? '' : `/${userLanguage}`;

pages2.forEach((page) => {
if (page.pathname.startsWith('/experiments') && process.env.DEPLOY_ENV !== 'production') {
if (page.pathname.startsWith('/experiments') && process.env.DEPLOY_ENV === 'production') {
return;
}
// The blog is not translated
Expand Down
19 changes: 19 additions & 0 deletions docs/nextConfigDocsInfra.js
Expand Up @@ -5,16 +5,35 @@ if (process.env.CONTEXT === 'deploy-preview') {
DEPLOY_ENV = 'pull-request';
}

/**
* ===================================================================================
* Fun facts about the `process.env.CONTEXT`:
*
* - It is defined by Netlify environment variables (https://docs.netlify.com/configure-builds/environment-variables/#build-metadata)
* - `process.env.CONTEXT === 'production'` does not mean mui.com build, it is the site configuration.
* 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. Make sure to checkout the right site before making any changes.
*
*/
if (process.env.CONTEXT === 'production' || process.env.CONTEXT === 'branch-deploy') {
DEPLOY_ENV = 'production';
}

if (process.env.CONTEXT === 'production' && process.env.HEAD === 'master') {
// For the Core team site, visit https://app.netlify.com/sites/material-ui/settings/deploys#branches for the config details.
DEPLOY_ENV = 'staging';
}
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved

if (
process.env.CONTEXT === 'branch-deploy' &&
(process.env.HEAD === 'master' || process.env.HEAD === 'next')
) {
DEPLOY_ENV = 'staging';
}
/**
* ====================================================================================
*/

process.env.DEPLOY_ENV = DEPLOY_ENV;

Expand Down