diff --git a/.github/workflows/cd-workflow.yml b/.github/workflows/cd-workflow.yml new file mode 100644 index 0000000..dc6ff2d --- /dev/null +++ b/.github/workflows/cd-workflow.yml @@ -0,0 +1,82 @@ +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 < ~/.databrickscfg + [TEST] + host = https://dbc-7fec11f6-2f19.cloud.databricks.com + client_id = ${{ secrets.SP_CLIENT_ID }} + client_secret = ${{ secrets.SP_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 < ~/.databrickscfg + [PROD] + host = https://dbc-af8eb77a-a3a0.cloud.databricks.com + client_id = ${{ secrets.SP_CLIENT_ID }} + client_secret = ${{ secrets.SP_CLIENT_SECRET }} + EOF + + - name: Deploy to PROD + run: | + databricks bundle deploy \ + --target prod \ + --profile PROD \ No newline at end of file diff --git a/.gitignore b/.gitignore index 957ee17..440bd32 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ __pycache__/ .venv*/ venv*/ +sandbox/ scratch/** !scratch/README.md **/explorations/**