CI/CD Pipelines
Integrate Cerebrium into your CI/CD workflow for automated deployments
If you would like to automatically deploy a new version of your app to production/development once you have merged into the respective branch, you can do so using the commands below. We will be using a GitHub Actions workflow.
1. Get your Cerebrium OAuth credentials
Cerebrium stores your credentials in the directory ~/.cerebrium/config.yaml
. If you run the command cat ~/.cerebrium/config
, then
you should see an output of three variables, namely:
- accessToken
- refreshToken
- projectId
We will need these in the next step.
2. Define secrets in your GitHub environment
Go to your GitHub repository → Settings → Environments
You should create a new environment with a title of your choice (“prod” and “dev”). Within these environments, you have two types of variables you can work with:
- Environment secrets: These are encrypted and do not show in your workflow logs
- Environment variables: These are not encrypted and will show in the workflow logs
In our use case, we will store all our variables (accessToken, refreshToken, projectId) as secrets to keep the values hidden.
3. GitHub Actions Workflow
In this flow, we do the following:
- Install a Python version of our choice (3.8 to 3.11).
- Install the Cerebrium package using pip.
- Log in to Cerebrium using our credentials.
- Deploy our app.
- Notify a Slack channel of successful deployment.