Deploy from GitHub

Deploy from GitHub

How to set up you CI/CD from GitHub directly from Clever Cloud, and how to deploy review apps.

Use the GitHub integration

Clever Cloud provides a GitHub integration to deploy any repository hosted on GitHub to Clever Cloud. You can deploy the same repository to multiple Clever Cloud applications from different branches. Select the appropriate branch in you application menu, in Information > Application edition > Used GitHub branch for deployment.

GitHub branch deployment

Clever Cloud asks for permission to access your GitHub repositories. Accept the permissions to allow the deployment. You can deploy both public or private repositories.

Deploy review apps from a PR on GitHub

You can automate deployments for review apps when a Pull Request opens on your GitHub repository by using Clever Cloud GitHub Action. This action uses Clever Tools to deploy a new app from the branch the Pull Request is based on and post a comment with the URL of the review app. The action redeploys the app on every new commit and deletes it when the Pull Request is closed (merged or not).

How to use the Review App GitHub Action

Two things are necessary to use the action:

  1. Use the script: Place the script in your .github/workflows directory and input the appropriate value to deploy your app. The script already provides a template you can modify at your convenience.
  2. Inject the environment variables from your repository: From your GitHub repository go to Settings > Secrets and variables. Inject them both in “Environment secrets” and “Repository secrets” to allow deployments from forked repositories.

Mandatory configuration

Your repository must contain at least the following variables to use the CLI:

  • CLEVER_TOKEN
  • CLEVER_SECRET

Find it in your machine, usually in ~/.config/clever-cloud/clever-tools.json, after installing Clever Tools.

⚠️ CLEVER_TOKEN and CLEVER_SECRET expire after one year. Make sure to set a reminder to inject the new ones to avoid breaking your pipelines.

Full instructions are available on the Action project.

Review App workflow example

To see a Review App workflow already in use, see this workflow on GitHub.

Troubleshooting

If you encounter troubles or bugs using the GitHub Action, feel free to open an issue on the repository.

🎓 Go further

Last updated on

Did this documentation help you ?