Install Jovo CLI Globally via Github Actions

cli

#1

I’m trying to use the jovo deploy functionality within a Github Action.

Currently trying to follow Jovo Quickstart Guide to install Jovo CLI globally.

Running the following code:
npm install -g jovo-cli

And getting the following error:
[Error: EACCES: permission denied, access '/usr/local/lib/node_modules']

Wondering if I need to install Jovo CLI globally? Or, just for this project…

Going to try installing CLI locally to see what happens.


#2

.github/workflows/deploy-dev.yml

name: Deploy to Dev (Alexa Skill)
on:
  push:
    branches: [ dev ]
jobs:
  deploy_website:
    name: build and deploy alexa skill (dev)
    strategy:
      matrix:
        node-version: [12.x]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - name: install Jovo CLI
        run: npm install -g jovo-cli
      - name: install ASK CLI
        run: npm install -g [email protected]
      - name: npm install
        run: npm i
      - name: jovo build & deploy
        run: jovo build -d --stage dev --platform alexaSkill


#3

Nope, Jovo needs to be installed globally or else this error occurs:

jovo: command not found


#4

BOOM! We got jovo recognized as a library in Github Actions!!!

Solution:

  1. use sudo for all commands (example at bottom of this reply).

Current Github Action
.github/workflows/deploy-dev.yml

name: Deploy to Dev (Alexa Skill)
on:
  push:
    branches: [ dev ]
jobs:
  deploy_website:
    name: build and deploy alexa skill (dev)
    strategy:
      matrix:
        node-version: [12.x]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - name: install Jovo CLI
        run: sudo npm install -g jovo-cli
      - name: install ASK CLI
        run: sudo npm install -g [email protected]
      - name: npm install
        run: sudo npm i
      - name: echo path
        run: echo $PATH
      - name: jovo build & deploy
        run: sudo jovo build -d --stage dev --platform alexaSkill


#5

Next Error:

Error: There was a problem:
 ›
 ›   [ERR] Invalid json: /home/runner/.ask/cli_config
 ›
 ›   Module:   jovo-cli-platform-alexa


#6

Working Github Actions Deploying to Alexa using Jovo CLI

SUCCESS!!!

.github/workflows/deploy-dev.yml

name: Deploy to Dev (Alexa Skill)
on:
  push:
    branches: [ dev ]
jobs:
  deploy_website:
    name: build and deploy alexa skill (dev)
    strategy:
      matrix:
        node-version: [12.x]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - name: install Jovo CLI
        run: sudo npm install -g jovo-cli
      - name: install ASK CLI
        run: sudo npm install -g [email protected]
      - name: npm install
        run: sudo npm i
      - name: move ask credentials
        run: sudo mv ./.ask/ /home/runner/.ask/
      - name: jovo build & deploy
        id: ask
        run: sudo jovo build -d --stage dev --platform alexaSkill
      - name: Get the output
        run: echo "The result was ${{ steps.ask.outputs.result }}"


#7

be sure to create .ask/cli_config file.

{
  "profiles": {
    "default": {
      "token": {
        "access_token": "<lwa-access-token>",
        "refresh_token": "<lwa-refresh-token>",
        "token_type": "bearer",
        "expires_in": 3600,
        "expires_at": "<lwa-expires-at>"
      },
      "vendor_id": "<vendor_id>",
      "aws_profile": "ask_cli_default"
    }
  }
}


#8

Great progress! Thanks for documenting this.