The CI/CD Workflow
A robust CI/CD workflow for Nango integrations involves these steps:- Push to Git: A developer pushes changes to a feature branch and opens a pull request.
- Automated Testing: The push triggers a CI pipeline that installs dependencies and runs your integration tests to verify correctness.
- Merge to Main: After the pull request is reviewed and approved, the changes are merged into the
mainbranch. - Deploy to Development: The merge to
mainautomatically triggers a deployment to yourdevenvironment in Nango. - Deploy to Production: A manual trigger (e.g., a
workflow_dispatchin GitHub Actions) is used to promote a specific version to theprodenvironment. This provides an airlock for production deployments.
Multi-Stage Deployments
We recommend a multi-stage deployment strategy to separate your development and production environments. This allows you to test changes in adev environment before promoting them to prod.
The Nango CLI supports this via the deploy command, which can target a specific stage:
dev.
Authentication
To deploy from a CI script, you need to authenticate using a secret key for each stage.- Generate Secret Keys: In the Nango UI, go to Settings > Secret Keys and generate a secret key for each stage (e.g.,
devandprod). - Store the Secret Keys: Store these keys as secrets in your CI/CD provider. We recommend naming them based on the stage, for example:
NANGO_SECRET_KEY_DEVNANGO_SECRET_KEY_PROD
Example: GitHub Actions
Here is an example of a GitHub Actions workflow that implements the multi-stage deployment strategy described above. You can find a complete example in the Nango GitHub Actions repository.Destructive ChangesA destructive change is a modification that removes an integration, sync, or action. To prevent accidental deletions, the
nango deploy command will prompt for confirmation if it detects a destructive change.In a CI environment, you can use the --auto-confirm or --allow-destructive flag to bypass this prompt. We recommend only using this with a manual trigger, as shown in the example.Testing in CI
We strongly recommend running tests in your CI pipeline before every deployment. This is your first line of defense against regressions. Nango’s testing framework uses dry runs and snapshot testing to validate your integrations without affecting production data. You can run your entire test suite with a single command:Related resources
- Testing integrations - A comprehensive guide to testing your Nango integrations.
- Nango GitHub Actions - A repository with a complete, reusable GitHub Action for deploying Nango integrations.