This guide can help you automate Dash app deployments to Plotly Cloud from your CI/CD pipeline.
dash[cloud] installed in your pipeline.plotly-cloud.toml committed to your repository. This file is created when you first publish your app with the CLI and tells the CLI which app to deploy to. See CLI Configuration for details.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
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
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
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)
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
ForbiddenError: you do not have permission to write to this app — API key access is not enabled for this app. Go to the app’s Sharing settings and set API keys to Can edit. See Managing API Key Access to Apps.APIError: invalid API key (HTTP 401) — The API key is invalid or not set. Verify the PLOTLY_API_KEY secret is configured correctly in your CI/CD platform.--poll-timeout or check your app’s build logs in Plotly Cloud.