CI/CD

Run lly in a CI pipeline. Unattended pipelines are not possible yet.

Unattended pipelines are not possible yet

A pipeline needs a credential that stays valid between runs. LILY does not issue one yet. Access tokens expire about 15 minutes after they are issued, and no command creates a token for CI. Dedicated pipeline credentials are planned. Until then, the workflow on this page only works for short jobs that receive a fresh token. Do not copy your local session into a pipeline: sessions rotate on renewal, and a copied session is terminated as soon as both copies are used.

LILY does not deploy automatically on push. This page describes how lly behaves in a CI pipeline, so that a pipeline can deploy on push once pipeline credentials are available.

lly has no separate CI mode. Without a terminal it does not prompt, so all input must come from flags, environment variables or a lily.toml. The exit code reports the result.

acme/shop
push to main
CI job
lly deploy -y
LILY
fetch, build, roll out
copperfox
Live
copperfox.lilylabs.app
The pipeline uploads no code. It tells LILY which ref to deploy, and LILY fetches it from GitHub.

Authentication

In a pipeline, lly reads an access token from LLY_ACCESS_TOKEN instead of a browser sign-in. The token is used as is: it is not stored and not renewed. It belongs to one workspace; -w and lly workspace <name> cannot change it. For deploy, init and redeploy, the token also authorizes the fetch from GitHub.

export LLY_ACCESS_TOKEN="<token>"   # from the CI secret store
lly whoami

Provide all input

Without a terminal, lly exits with code 2 if a choice is open and names the flag to set:

error: which roots? pass --apps ROOT,... or --all; supported: apps/web, services/api

Set project, ref and apps with flags or in a lily.toml:

lly deploy --project shop --ref main --apps apps/web,services/api

Defaults with -y

SituationWith -y
Roots to deployAll supported roots
Project name takenSuggested name, for example shop-2
Proposed variable without valueSkipped
Proposed connectionAccepted
delete, domain removeConfirmed

Without -y and without a terminal, lly exits if the roots are not set or a confirmation defaults to no. Prompts that default to yes, such as proposed connections, are accepted.

Pipeline setup for deploy on push

This setup does not run unattended today. The token in LLY_ACCESS_TOKEN expires about 15 minutes after it is issued, so a job only works while the token is fresh. The section shows how a pipeline is wired, so that it works once pipeline credentials are available.

lly deploy with the same repository and ref redeploys the existing apps. The same command works for the first and every following deploy. It reads the repository from the origin remote of the checkout, which must point to GitHub.

GitHub Actions

.github/workflows/deploy.yml
name: Deploy
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: curl -fsSL https://get.lilylabs.io/install.sh | sh -s -- --system
      - run: lly deploy --project shop --ref main -y
        env:
          LLY_ACCESS_TOKEN: ${{ secrets.LLY_ACCESS_TOKEN }}

Other CI systems

If the checkout does not come from GitHub, name the repository:

lly deploy acme/shop --project shop --ref main -y

Single app at a specific commit

lly redeploy copperfox --project shop --ref "$GITHUB_SHA"

Results

lly deploy follows the build and exits when all apps are deployed or one has failed. The job result matches the deploy result.

CodeMeaning
0Deployed
2Open choice. The message names the flag.
3Token missing, expired or without permission
5Another build or command is running
6LILY or GitHub unreachable, or timeout. Retry the job.
7Build or rollout failed. lly attach --build <slug> shows the cause.
  • --detach returns after the configuration is accepted. The job succeeds even if the build fails later.
  • --json prints results as JSON on stdout and progress on stderr. deploy prints two JSON documents: configuration and summary.
  • Without a terminal, colors are disabled. NO_COLOR or --no-color disable them explicitly.

Environment variables

VariableDescription
LLY_ACCESS_TOKENAccess token
LLY_PROJECT, LLY_APPSame as --project and --app
LLY_WORKSPACESame as --workspace. Must match the workspace of the token.
NO_COLORDisable colors

On this page