Deploy your static site to Netlify using Gitlab CI

A brilliant idea to deploy a static site is using Netlify. Its free tier comes with custom domain mapping, free SSL certificate, and forces HTTPS.

Netlify also supports Hugo & Jekyll like static site generator tools.

The basic process to deploy a static site in Netlify is you have to generate a static site using the tools mentioned above. Then you can commit the code in some git repository. Netlify supports Github, Bitbucket & Gitlab as of now. After that we have to create a new site from the Netlify UI.

Now we would like to deploy every git commit to Netlify. To accomplish this task we are choosing Gitlab CI and Netlify cli.

To avail this we just have to add a new file in the root directory of the git repository named .gitlab-ci.yml .

A sample file is given below:

After adding this every commit will be deployed to your Netlify site.