Integrate into CI/CD
Automated Deploys
It’s fairly straightforward to setup automation for deploying your code to Beam. At a high level, the following steps are all you need:
curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | sh
pip3 install --upgrade pip
pip3 install beam-sdk
beam configure --clientId=$BEAM_CLIENT_ID --clientSecret=$BEAM_CLIENT_SECRET --profile=$PROFILE
beam deploy app.py --$PROFILE
Authentication
You can initialize Beam with inline credentials using the beam configure
command.
You can also add an optional field --profileName
to override the default profile. For example, you might want separate dev, staging, and prod profiles.
beam configure --clientId="MY_CLIENT_ID" --clientSecret="MY_CLIENT_SECRET" --profileName="staging"
Example: Github Actions
You can setup a Github workflow to deploy your code whenever a new commit is made to your Git repo.
Setup Environment Variables
First, add your BEAM_CLIENT_ID
and BEAM_CLIENT_SECRET
to your Github Variables:


Create Actions file
For a detailed walk-through of this step, Github’s documentation is the best resource.
- Create a directory called
.github/workflows
in your project. - In the
.github/workflows
directory, create a file namedbeam-actions.yml
Here’s what the workflow file could look like:
Build the workflow
Example: Generate Deployment Preview on Commit
name: BeamDeploymentPreview
on: [push]
env:
BEAM_CLIENT_ID: ${{ secrets.BEAM_CLIENT_ID }}
BEAM_CLIENT_SECRET: ${{ secrets.BEAM_CLIENT_SECRET }}
PROFILE: ${{ secrets.BEAM_PROFILE }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: "Authenticate"
run: |
curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | sh
pip3 install --upgrade pip
pip3 install beam-sdk
beam configure --clientId=$BEAM_CLIENT_ID --clientSecret=$BEAM_CLIENT_SECRET
- uses: actions/checkout@v3
- name: "Serve"
# Replace app.py with the path to your Beam entry point
run: |
{
echo 'PREVIEW_URL<<EOF'
beam serve app.py
echo EOF
} >> "$GITHUB_ENV"
stopMarker=$(uuidgen)
echo "::stop-commands::$stopMarker"
- name: "Generate URL"
run: |
echo "$PREVIEW_URL"
When you push to the repo, this workflow will run, generating a Beam Deployment Preview.

You can call this API to test your code in the ephemeral environment.
Example: Deploy on Commit
Here’s another example, showing how to automatically deploy an app when pushing code to the master
branch of your repo:
name: deploy-beam
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- name: Authenticate Beam and Deploy
env:
BEAM_CLIENT_ID: ${{ secrets.BEAM_CLIENT_ID }}
BEAM_CLIENT_SECRET: ${{ secrets.BEAM_CLIENT_SECRET }}
PROFILE: ${{ secrets.BEAM_PROFILE }}
run: |
curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | sh
pip3 install --upgrade pip
pip3 install beam-sdk
beam configure --clientId=$BEAM_CLIENT_ID --clientSecret=$BEAM_CLIENT_SECRET
beam deploy app.py
Was this page helpful?