.github/workflows/cd-workflow.yml
name: CD Workflow
on:
push:
branches:
- main
jobs:
cd-deploy-test:
name: Deploy to TEST
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Databricks CLI
run: curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install setuptools wheel
- name: Configure Databricks
run: |
# write out the profile (here called "TEST")
cat <<EOF > ~/.databrickscfg
[TEST]
host = your-databricks-workspace-url
azure_tenant_id = ${{ secrets.AZURE_TENANT_ID }}
azure_client_id = ${{ secrets.AZURE_CLIENT_ID }}
azure_client_secret = ${{ secrets.AZURE_CLIENT_SECRET }}
EOF
- name: Deploy to TEST
run: |
databricks bundle deploy \
--target test \
--profile TEST
cd-deploy-prod:
name: Deploy to PROD
needs: cd-deploy-test
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Databricks CLI
run: curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install setuptools wheel
- name: Configure Databricks
run: |
# write out the profile (here called "PROD")
cat <<EOF > ~/.databrickscfg
[PROD]
host = your-databricks-workspace-url
azure_tenant_id = ${{ secrets.AZURE_TENANT_ID }}
azure_client_id = ${{ secrets.AZURE_CLIENT_ID }}
azure_client_secret = ${{ secrets.AZURE_CLIENT_SECRET }}
EOF
- name: Deploy to PROD
run: |
databricks bundle deploy \
--target prod \
--profile PROD