To create your project's preview page, follow these steps:
- Create the preview branch:
- In your GitLab repository, create a branch called:
preview - Any changes you want to see in preview must be pushed to this branch.
- In your GitLab repository, create a branch called:
- Configure the branch in Netlify
- Open your project in Netlify → Project configuration → Build & Deploy → Branches and deploy contexts → Configure
- Change Branch deploys to
Let me add individual branches - Type
previewand press Enter - Click Save
- Configure environment variables per context
- Go to Project settings → Environment variables
- Edit the
APP_ENVvariable to have different values per deploy context - Configure as follows:
Context Value Production production Deploys Preview preview Branch Deploys preview Preview Server & Agent Runners production Local Development (Netlify CLI) development - Click Save variable
- Now, the next time you push to the
previewbranch, the Netlify deploy will start automatically.