This guide assumes you have a working static website project on your machine integrated with DatoCMS

If that's not your case, you can return to the previous sections of this documentation to see how to properly configure the DatoCMS administrative area and how to integrate DatoCMS with your favorite static website generator.

Create your Git repository

DatoCMS supports both Gitlab.com and self-hosted instances of Gitlab CE. The first thing to do is to initialize a new Git repository on your website local directory:

$ git init
$ git add .

Commit the files that you've staged in your local repository.

$ git commit -m 'First commit'

Now create a new repository on Gitlab. Once done, copy the remote repository URL. In Terminal, add the URL for the remote repository where your local repository will be pushed.

$ git remote add origin YOUR_GITLAB_REPOSITORY_URL

Now, it's time to push the changes in your local repository to Gitlab.

git push -u origin master

Now that your project is up and running on Gitlab, let's configure a Gitlab Pipeline that will publish your website on S3 after each further Git push.

Enable Gitlab Pipeline

GitLab offers a continuous integration service out of the box. If you add a .gitlab-ci.yml file to the root directory of your repository, then each commit or push triggers your CI pipeline.

Configure .gitlab-ci.yml

The .gitlab-ci.yml file tells the GitLab runner what to do. By default it runs
a pipeline with three stages: build, test, and deploy. You don't need to
use all three stages; stages with no jobs are simply ignored.

Connect TravisCI to DatoCMS

There's only one last step needed: connecting DatoCMS to TravisCI, so that everytime one of your editors press the Publish changes button in your administrative area, a new build process (thus a new publication of the final website) gets triggered.

To do so, go to the Admin area > Deployment settings and select TravisCI:

In the window that will appear, follow the instructions to conclude the integration:

When everything is done, confirm the integration pressing the Save Settings button.