To use the various ecosystems CastHub provides to Developers, we offer an official CLI tool that can use used in a CI/CD environment, or locally for ease-of-use.
CastHub CLI is available via NPM/Yarn, and can be installed globally or locally, based on your workflow.
yarn global add @casthub/cli
npm install -g @casthub/cli
If you install globally, ensure you have the NPM/Yarn
bin in your
$PATH if you are told the command could not be found:
Most CLI commands require authentication to work, such as uploading assets and creating new content versions. This is done using a Personal Access Token. These are authentication tokens that don't expire, and grant complete access to your published content. As such, you should protect them like you would a password, and never store them in repositories.
To generate a Personal Access Token, you'll need to download and install the CastHub App, activate Developer Tools and navigate to the Developers section. From here, there is a
Personal Access Tokens tab.
When creating a Personal Access Token, you'll be given a list of available scopes. For the purposes of the CLI (Whether for use on your own machine or in CI/CD), you should only select the
cli scope. This scope will grant the token access to only the areas of your Account that are needed by the CLI tool.
Once you have your Personal Access Token (Remember, you'll only ever see it after creation for security purposes), you can tell the CLI to use that token:
$ casthub token MY_TOKEN