deploy-solution-sites #30
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: deploy-solution-sites | |
env: | |
DB_TOKEN: ${{ secrets.DB_TOKEN }} | |
DB_HOST: ${{ secrets.DB_HOST }} | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_ACCESS_SECRET: ${{ secrets. AWS_ACCESS_SECRET }} | |
GH_TOKEN: ${{ github.token }} | |
on: | |
workflow_dispatch: | |
inputs: | |
repository_path: | |
description: 'Repository path on E2 field eng' | |
required: true | |
default: '/Workspace/Repos/[email protected]/esg-scoring' | |
solution_name: | |
description: 'Code name of the solution' | |
required: true | |
default: 'esg_scoring' | |
permissions: | |
contents: write | |
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: | |
# The first step is obviously to check out the repository | |
- name: Checkout project | |
uses: actions/checkout@v2 | |
- name: Configure git | |
run: | | |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" | |
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)" | |
- name: Retrieve latest site | |
run: | | |
git subtree split --prefix site/ -b gh-pages | |
git push -f origin gh-pages:gh-pages | |
git branch -D gh-pages | |
# We test and package our code against python 3.9 distribution | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.9" | |
# we create our own pip cache where dependencies from requirements.txt will be stored | |
- 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- | |
# Let's install pip and make sure we run against latest version | |
- name: Install pip | |
run: python -m pip install --upgrade pip | |
# And install any dependency required for unit testing | |
- name: Install dependencies | |
run: pip install -U -r requirements.txt | |
# Package and publish solution | |
- name: Publish solution accelerator | |
run: python databricks.py --path ${{ github.event.inputs.repository_path }} --name ${{ github.event.inputs.solution_name }} | |
- name: Deploy solution to github page | |
run: | | |
git add . | |
git commit -a -m "Adding solution [${{ github.event.inputs.solution_name }}]" | |
git push | |
git subtree push --prefix site/ origin gh-pages |