CI/CD with TravisCI and Netlify
👉🏻 Full article here
This is a repository to experiment CI/CD with TravisCI and Netlify, configuring TravisCI to test, build and then deploy your website on Netlify. For more about CI/CD with TravisCI and Netlify read this article.
First you need to disable automatic builds in Netlify site dashboard under Build & Deploy > Continuous Deployment > Build settings. Without this option I suggest to run a separate instance on Netlify to easily keep features like site preview on pull requests (check this pull request to see how it works)
TravisCI uses Netlify CLI to deploy your site as you can see in .travis.yml configuration file. Netlify CLI needs to know who you are and the target site you want to deploy.
- Under
Personal access tokens, selectNew access token. - Enter a description and select
Generate token. - Copy the generated token to your clipboard (once you navigate from the page, the token cannot be seen again!) and add it to a
NETLIFY_AUTH_TOKENenvironment variable in TravisCI.
To set the target site to deploy
- From the Netlify site dashboard, go to
Settings>General>Site details>Site information, and copy the value forAPI ID. - Assign the
API IDto aNETLIFY_SITE_IDenvironment variable in TravisCI.
Run the project locally
yarn install
yarn serveRun your tests
yarn test:unit