From 35af254bc36663f6143e4bfea122a4237a7f3080 Mon Sep 17 00:00:00 2001 From: Antoine Amend Date: Fri, 8 Mar 2024 20:51:28 -0500 Subject: [PATCH] Adding workflow --- .github/workflows/publish.yaml | 74 +++++++++++++++++++++++ .github/workflows/{test.yml => test.yaml} | 0 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/publish.yaml rename .github/workflows/{test.yml => test.yaml} (100%) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..d7716b2 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,74 @@ +name: publish + +env: + DB_PROFILES: ${{ secrets.DB_PROFILES }} + +on: + workflow_dispatch: + inputs: + db_profile: + type: string + description: 'Databricks environment to publish HTML from' + default: 'DEMO' + db_path: + type: string + description: 'Repository path on databricks environment' + required: true + +permissions: + contents: read + pages: write + id-token: write + +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: Install dependencies + run: | + pip install git+https://github.com/databricks-industry-solutions/industry-solutions-release + + - name: Package solution accelerator + run: | + + import os + import configparser + import io + from databricks.solutions import Accelerator + + config = configparser.ConfigParser() + config.read_file(io.StringIO(os.environ['DB_PROFILES'])) + if '${{ github.event.inputs.db_profile }}' not in config.sections(): + raise Exception('Provided DB_PROFILE is not supported') + config = config['${{ github.event.inputs.db_profile }}'] + + Accelerator( + db_host=config['host'], + db_token=config['token'], + db_path='${{ github.event.inputs.db_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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yaml similarity index 100% rename from .github/workflows/test.yml rename to .github/workflows/test.yaml