CI: update env vars step #6
Workflow file for this run
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: Continuous Testing and Publication from 'dev' | |
on: [push] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run-tests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- name: Checkout this repository | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Prepare environment variables | |
shell: bash -l {0} | |
run: | | |
export DEMO_ACCOUNT_ID="${{ secrets.DEMO_ACCOUNT_ID }}" | |
echo "DEMO_ACCOUNT_ID=${DEMO_ACCOUNT_ID}" >> $GITHUB_ENV | |
export DEMO_AUTH_TOKEN="${{ secrets.DEMO_AUTH_TOKEN }}" | |
echo "DEMO_AUTH_TOKEN=${DEMO_AUTH_TOKEN}" >> $GITHUB_ENV | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
set -euo pipefail | |
pip install virtualenv | |
virtualenv .env | |
source .env/bin/activate | |
pip install --no-deps -r requirements.txt | |
pip install --no-deps -e . | |
pip install nbstripout | |
pip list | |
- name: Update utils/settings.json | |
shell: python | |
run: | | |
import os, json | |
settings_file = "utils/settings.json" | |
with open(settings_file, "r") as fp: | |
settings = json.load(fp) | |
settings["ACCOUNT_ID"] = os.getenv("DEMO_ACCOUNT_ID", "") | |
settings["AUTH_TOKEN"] = os.getenv("DEMO_AUTH_TOKEN", "") | |
# TODO: update secrets with the MP API key | |
# settings["MATERIALS_PROJECT_API_KEY"] = "MATERIALS_PROJECT_API_KEY" | |
with open(settings_file, "w") as fp: | |
json.dump(settings, fp, indent=4) | |
- name: Render notebooks | |
run: | | |
set -euo pipefail | |
source .env/bin/activate | |
bash scripts/render-notebooks.sh |