Skip to content

Staging

Charles Greene edited this page Jun 9, 2017 · 1 revision

Staging

It is usually necessary to have multiple versions of your roku app. For example you could have a production and staging version of your app. RokuBuilder allows for this by using stages. There are two methods of staging, git, or script.

If you choose to stage via git then for each stage you will define a git branch or ref. While staging (like durning packaging) RokuBuilder will stash all changes, checkout the defined branch, complete the requested action, checkout the orginal branch, and pop stashed changes.

If you choose to use script staging then for each stage you will define a script to run that will change the app directory approiatly for that stage. You may also optionally define an unstage script that will return the directory to a clean working state. The script can be anything that will run in the project directory.

A script staging example would be if you have a shell script (stage.sh) that append a config url in your manifest. You would have a different url for each stage:

#! /bin/bash
if [ "production" = $1 ]; then
  echo "url=https://prod.url.com" >> manifest
else
  echo "url=https://staging.url.com" >> manifest
fi

You could also have a script (unstage.sh) that removed that last line:

#! /bin/bash
mv manifest manifest.tmp
head -n -1 manifest.tmp > manifest
rm manifest.tmp

In your config you could have the following two stages assuming that these scripts were in the project root directory:

"stages": {
  "prod": {
    "script": {"stage": "./stage.sh production", "unstage": "./unstage"}
  }
  "staging": {
    "script": {"stage": "./stage.sh staging", "unstage": "./unstage"}
  }
}

This would allow you to use the following two commands:

$ roku -ls prod
$ roku -ls staging

This would sideload the app with the approiate url in the manifest.

Clone this wiki locally