publish #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
env: | |
DB_AWS_DEMO_TOKEN: ${{ secrets.DB_AWS_DEMO_TOKEN }} | |
DB_AWS_FIELD_TOKEN: ${{ secrets.DB_AWS_FIELD_TOKEN }} | |
DB_GCP_TOKEN: ${{ secrets.DB_GCP_TOKEN }} | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: 'Databricks environment to publish HTML from' | |
options: | |
- e2-demo-field-eng.cloud.databricks.com | |
- e2-demo-west.cloud.databricks.com | |
- 6177827686947384.4.gcp.databricks.com | |
path: | |
type: string | |
description: 'Repository path on databricks environment' | |
required: true | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.9" | |
- name: Configure Python | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
git config --global url."https://${{ secrets.GH_TOKEN }}@github".insteadOf https://github | |
pip install git+https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/databricks-industry-solutions/industry-solutions-release | |
- name: Package solution accelerator | |
run: | | |
import os | |
from databricks.solution import Accelerator | |
db_host = ${{ github.event.inputs.environment }} | |
if db_host == 'e2-demo-field-eng.cloud.databricks.com': | |
db_token = os.environ['DB_AWS_FIELD_TOKEN'] | |
elif db_host == 'e2-demo-west.cloud.databricks.com': | |
db_token = os.environ['DB_AWS_DEMO_TOKEN'] | |
elif db_host == '6177827686947384.4.gcp.databricks.com': | |
db_token = os.environ['DB_GCP_TOKEN'] | |
else: | |
exit(1) | |
Accelerator( | |
db_host=db_host, | |
db_token=db_token, | |
db_path=${{ github.event.inputs.path }}, | |
db_name=${{ github.event.repository.name }}, | |
).release() | |
shell: python | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'site' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |