Deploy using Travis CI
It is now super easy to set up continuous integration for projects running on the Includable platform. In this tutorial we’ll show you how to use Travis CI to build static assets and deploy the result to Includable.
First make sure you have the latest version of the Includable CLI installed:
npm i -g includable
Then, you can start creating your first Includable module:
inc create. Let’s go for the
inc run) and checks those into their Git repo.
A cleaner solution would be to automatically create those when a new change is committed, and automatically deploying those assets to the Includable Platform. In order to do that, we’ll use Travis CI, one of the many available continuous integration solutions (some others to check out are Circle CI and Codeship).
First off, we want to make sure that compiled static assets are never checked into version control, since they will be created before deployment by our Travis CI script.
In order to do so, we add the following lines to
Creating Travis Config
Every CI solution has their own way of configuring what scripts and tests to run. Travis CI requires you to add a file called
.travis.yml to your repo. Let’s add that with the following contents:
language: php install: - composer install - npm install -g includable - npm install script: - npm run build after_success: - inc publish
You can now create you initial commit, and push your code to a public Github repository in the usual way.
Getting started with Travis CI
The only thing left is to tell Travis CI to build your project. For that, simply sign in to travis-ci.org with your Github account.
You can then flip the switch next to the repository you just created to trigger your first build. What you need to do, though, to make sure the build succeeds, is add your Includable token, otherwise Includable won’t know if you are authorized to update your module or not.
You can get your token by going back to your command line, and running
inc login --token. The value you will then get back you can add to your environment variables in the Travis CI settings:
That should do it, you have now set up a continuous integration flow to automatically build and publish any changes you push to your Github repository automatically to Includable.
You can find the example code for this guide on Github: example-ci.