Continuous Integration for Alexa Skills

Alexa Skills recently get a lot of traction. Amazon just released the Echo Show and has almost ten thousands skills.

But as a developer they are question how to maintain skills in a scalable fashion. The good old times of maintaining cloud software via sftp and ssh are basically over. Today we utilizing modern tools such as CI servers to build and deploy software and now we can do the same for Alexa Skills.

In this example we are using GitLab’s CI implementation to build and deploy an Alexa Skill. GitLab uses Docker to create the final output and I created an unique build image that contains all necessary parts to build and deploy an Alexa Skill. Ironically the build image is hosted on Github.

Let’s gets started by defining our GitLab CI file. GitLab’s CI uses the YAML format.

stages:
-build

build:
stage: build
image: flyandi/ci-build-image-aws-lambda-node
script:
- mkdir -p ./build
- cd ./src && npm install --no-progress
- zip -X -r ../build/release.zip *
- aws lambda update-function-code --function-name LambdaFunctionName --zip-file fileb://./build/release.zip
cache:
paths:
- ./src/node_modules
artifacts:
paths:
- ./build/release.zip
expire_in: 1 day

This defines the basic CI file that builds the skill, zip’s it up and sends it to a pre-defined Lambda function.

The CI process will download the flyandi/ci-build-image-aws-lambda-node docker build image that contains all necessary tools to build and deploy an Alexa Skill (and can also be used for other purposes).

Now you have it. With a couple lines of code you fully automatized your Alexa Skill build and deployment to AWS.

Get the build image and read more about it on my GitHub page.

View on GitHub