Skip to content

CI/CD

GitHub Actions and GitLab CI recipes for publish-on-build with DISPLAYDEV_API_KEY.

On this page

Wire dsp publish into your build so every merge produces a fresh URL. Common cases are an HTML report from your build (a static dashboard, an MkDocs site, an agent-authored research dossier regenerated on a schedule).

Authentication

In every CI flow, set the DISPLAYDEV_API_KEY secret. The CLI reads it from the environment:

bash
export DISPLAYDEV_API_KEY=<api-key>
BASE_VERSION=$(dsp get <shortId> | jq -r .currentVersion)
dsp publish report/index.html --id <shortId> --base-version "$BASE_VERSION"

Store the key as a GitHub Actions secret, GitLab CI variable, or whatever your CI exposes. Never check it in.

Label CI publishes for the audit log

--actor-name labels the publish so the audit log distinguishes CI runs from hand publishes. The actor classification stamped alongside it depends on the credential:

  • User-scoped API keyagent (CI is non-TTY, so the CLI's auto-detection lands on agent).
  • Organization-scoped API keyservice (the server stamps this from the credential; not overridable).
bash
BASE_VERSION=$(dsp get <shortId> | jq -r .currentVersion)
dsp publish report/index.html --id <shortId> --base-version "$BASE_VERSION" --actor-name ci-deploy

See Actor for the full classification.

GitHub Actions

yaml
name: Publish report
 
on:
  push:
    branches: [main]
 
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22 }
      - run: npm ci
      - run: npm run build:report
      - run: |
          BASE_VERSION=$(npx -y @displaydev/cli get "${{ vars.DISPLAY_ARTIFACT_ID }}" | jq -r .currentVersion)
          npx -y @displaydev/cli publish dist/report.html --id "${{ vars.DISPLAY_ARTIFACT_ID }}" --base-version "$BASE_VERSION"
        env:
          DISPLAYDEV_API_KEY: ${{ secrets.DISPLAYDEV_API_KEY }}

Try this without committing

Before pushing the YAML, sanity-check the publish locally:

bash
export DISPLAYDEV_API_KEY=<api-key>
BASE_VERSION=$(dsp get <shortId> | jq -r .currentVersion)
dsp publish dist/report.html --id <shortId> --base-version "$BASE_VERSION"

If the local invocation prints a URL, your YAML will work too.

GitLab CI

yaml
publish:
  stage: deploy
  image: node:22
  script:
    - npm ci
    - npm run build:report
    - |
        BASE_VERSION=$(npx -y @displaydev/cli get "$DISPLAY_ARTIFACT_ID" | jq -r .currentVersion)
        npx -y @displaydev/cli publish dist/report.html --id "$DISPLAY_ARTIFACT_ID" --base-version "$BASE_VERSION"
  variables:
    DISPLAYDEV_API_KEY: $DISPLAYDEV_API_KEY
  only:
    - main

Set DISPLAYDEV_API_KEY and DISPLAY_ARTIFACT_ID as CI/CD variables in the project settings. Each run reads the current version with dsp get <shortId> immediately before publishing; if another publish lands between the read and write, reconcile and rerun with the new version printed by the CLI.

Was this page helpful?