Running in CI
The CLI is non-interactive by design. A GitHub Action, and the one thing to get right.
The CLI runs unattended without a wrapper, which is the point of it in a pipeline.
Authenticate with an environment variable
Set API_TOKEN. There is no login step, no prompt, and nothing stored on the runner.
export API_TOKEN=$SCREENLY_API_TOKEN
screenly screen list -o json
GitHub Actions
There is a published action:
- uses: screenly/cli@master
with:
screenly_api_token: ${{ secrets.SCREENLY_API_TOKEN }}
cli_commands: edge-app deploy
cli_commands takes any command, so the same step deploys an app, uploads an asset, or reassigns a playlist. cli_version pins a version if you would rather not track the latest.
CLI versions are year and month, from 26.8.0 on. A range like 1.x or ^1.2 never matches a release again, so pin 26.8.0 or later.
For edge apps there are also dedicated actions and reusable workflows that build, deploy, and handle stage and production for you. See Deploy with GitHub Actions.
Anything that can run a binary works the same way: GitLab CI, CircleCI, Jenkins.
The thing to get right
Scope the token. A pipeline token carries the permissions of whoever created it, and it lives in a secret store that more people can read than you might assume.
Create it from an account with the access the pipeline actually needs, name it after the pipeline rather than the person, and revoke it when the pipeline is retired. See API tokens.
Deploying an app from a pipeline
The natural fit: your app is code in a repository, and a push deploys it to every screen running it.
export EDGE_APP_ID=$SCREENLY_EDGE_APP_ID
screenly edge-app validate
screenly edge-app deploy
Validate first. It catches a malformed manifest before the deploy reaches any screens.
Set the app's ID in EDGE_APP_ID, from a secret or variable in your CI. The CLI reads it before the id field in screenly.yml, so the pipeline decides which app a deploy lands on, and the manifest stays the same for everyone who clones the repository.
The id field in screenly.yml still works when EDGE_APP_ID isn't set, but it is deprecated, and the CLI prints a warning each time it falls back to it.