Skip to main content

Gitlab CI/CD

To make deployment easier than uploading via FTP, you can connect to Gitlab CI/CD for Continuous Integration and Continuous Deployment. When setup, any changes you make to your project that are pushed to your repo automatically deploy to our webserver.

Setup#

To setup Gitlab CI/CD you'll first need to add your project to Gitlab. Make sure that your project is being added to the Pearson CT group. If the project falls outside this folder, you cannot integrate CI/CD.

Once your project has been added and files have been pushed to the repo, open your project and navigate to Settings, in the left hand nav bar. You will see a CI/CD link in the subgroup of Settings. Click that.

In the CI/CD panel you need to add 2 project variables. Find the Variables panel and expand it.

Next, add 2 Variables.

DEPLOY_FOLDER#

The value of this is the folder that stores your build files. In most instances, the value will be build, but its also common for apps to deploy to public or dist folders as well. If your project is simply plain HTML files, static is a good folder name to use.

DEPLOY_FOLDER = build

PROJECT_PATH#

The value of this is the typically the name of your repo, and will be the endpoint to your deployed project.

PROJECT_PATH = my-prototype

Important Note If the project path is 'my-prototype', your project will be deployed to: https://ux.pearson.com/prototypes/my-prototype

Add .gitlab-ci.yml#

After your variables are added, go back to your project dashboard and click CI/CD configuration (it’s just above the directory listing.) You will be asked to add the contents of a .gitlab-ci.yml file.

We have done this for you, so go to this link and copy its contents. Next, paste it into the .gitlab-ci.yml editor.

Important Note Ensure that the option under only: refs: (line 8 in the provided configuration) matches the name of the branch you want to deploy. This is usually called master, but is sometimes main.

Click Commit changes to add the file to your project. Once this is done, your integration is complete and your files will start to build and deploy.