CI/CD

This guide can help you automate Dash app deployments to Plotly Cloud from your CI/CD pipeline.

Prerequisites

Setting Up Your Pipeline

GitHub Actions

Create .github/workflows/deploy.yml in your repository:

name: Deploy to Plotly Cloud

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install dependencies
        run: pip install "dash[cloud]"

      - name: Deploy to Plotly Cloud
        env:
          PLOTLY_API_KEY: $secrets.PLOTLY_API_KEY
        run: plotly app publish --name my-app

GitLab CI/CD

Add to your .gitlab-ci.yml:

deploy:
  image: python:3.12
  stage: deploy
  only:
    - main
  script:
    - pip install "dash[cloud]"
    - plotly app publish --name my-app
  variables:
    PLOTLY_API_KEY: $PLOTLY_API_KEY

Bitbucket Pipelines

Add to your bitbucket-pipelines.yml:

pipelines:
  branches:
    main:
      - step:
          name: Deploy to Plotly Cloud
          image: python:3.12
          script:
            - pip install "dash[cloud]"
            - plotly app publish --name my-app

Azure DevOps

Add to your azure-pipelines.yml:

trigger:
  branches:
    include:
      - main

pool:
  vmImage: 'ubuntu-latest'

steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '3.12'

  - script: pip install "dash[cloud]"
    displayName: Install dependencies

  - script: plotly app publish --name my-app
    displayName: Deploy to Plotly Cloud
    env:
      PLOTLY_API_KEY: $(PLOTLY_API_KEY)

Checking Deployment Status

The publish command polls for completion by default (--poll-status), so your pipeline waits until the app is live before finishing.

You can also check the status of a published app separately. Run this from the project directory (which contains the plotly-cloud.toml created during publish):

plotly app status

If your pipeline has strict timeout requirements, adjust with --poll-timeout:

plotly app publish --name my-app --poll-timeout 300

Troubleshooting