When the code is checked in the previous steps, it is time to deploy the Skill to the Alexa cloud in order to start the next steps that will run different kind of tests. There are some tests like VUI tests, integrations tests, end-to-end tests and validation tests that we cannot run in localhost only with our code. This is why we need to deploy the Alexa Skill to the development stage.
These step are automated in the continuous integration system (CircleCI) and are executed in each new version of the software.
Here you have the technologies used in this project
- ASK CLI - Install and configure ASK CLI
- CircleCI Account - Sign up here
- Node.js v10.x
- Visual Studio Code
The Alexa Skills Kit Command Line Interface (ASK CLI) is a tool for you to manage your Alexa skills and related resources, such as AWS Lambda functions. With ASK CLI, you have access to the Skill Management API, which allows you to manage Alexa skills programmatically from the command line. We will use this powerful tool to validate our Alexa Skill. Let's start!
The ASK CLI is included in the Docker image we are using so it is not necessary to install anything else.
In this step of the pipeline we are going to deploy our Alexa Skill using the ASK CLI to the development stage. When you deploy your skill to the development stage, it will update the skill manifest, interaction models, buckets, in-skill-purchasing products and lambda to the Alexa Cloud and AWS. We can use the following commands in the ASK CLI to manage this deployment of our Alexa skill:
- For ask cli v1:
ask deploy --debug --force- For ask cli v2:
ask deploy --debug --ignore-hashThere are not reports defined in this job.
It is not necessary to integrate it in package.json file.
The deploy job will execute the following tasks:
- Restore the code that we have used in the previous step in
/home/node/projectfolder - Copy the
package.jsontosrc/folder. - Execute the
npm run build-productioncommand that will install only the production libraries in thesrc/folder. - Run
ask deploy --debug --forcethat will deploy all the code insrc/folder as an AWS lambda. - Persist again the code that we will reuse in the next job
deploy:
executor: ask-executor
steps:
- attach_workspace:
at: /home/node/
- run: cd lambda/custom && npm run copy-package
- run: cd lambda/custom/src && npm run build-production
- run: ask deploy --debug --force
- persist_to_workspace:
root: /home/node/
paths:
- projectNOTE: If you want to run successfully every ASK CLI command, you have to set up 5 environment variables:
ASK_DEFAULT_PROFILEASK_ACCESS_TOKENASK_REFRESH_TOKENASK_VENDOR_IDAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
And configure the __ENVIRONMENT_ASK_PROFILE__ profile in your .ask/config file.
How to obtain these variables and how to configure this profile are explained in this post
- DevOps Wikipedia - Wikipedia reference
- Official Alexa Skill Management API Documentation - Alexa Skill Management API Documentation
- Official CircleCI Documentation - Official CircleCI Documentation
Thanks to the ASK CLI we can perform this complex task.
I hope this example project is useful to you.
That's all folks!
Happy coding!