Skip to content

Preview

Preview #44

Workflow file for this run

name: Preview
on:
workflow_run:
workflows: ["Build and push container image"]
branches: [postprint]
types: [completed]
# This job installs dependencies, build the jupyter notebook, and pushes it to `preview`, a new `branch`
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'eds-book-gallery' && github.event.workflow_run.conclusion == 'success' }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Check conditions meet
run: echo 'The triggering workflow passed'
- uses: actions/checkout@v2
with:
ref: postprint
# Set notebook name
- name: Get properties from the config file
id: config_file
uses: notiz-dev/github-action-json-property@release
with:
path: '.github/config.json'
prop_path: 'notebook_name'
# Set quay image
- name: Get properties from the config file
id: config_quay
uses: notiz-dev/github-action-json-property@release
with:
path: '.github/config.json'
prop_path: 'quay_image'
# Set kernel name
- name: Get properties from the config file
id: config_kernel
uses: notiz-dev/github-action-json-property@release
with:
path: '.github/config.json'
prop_path: 'kernel'
# Render the notebook
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: quay.io/${{steps.config_quay.outputs.prop}}:latest
options: --user root -v ${{ github.workspace }}:/tmp
shell: bash
run: |
v=$(jupyter kernelspec list | awk '{print $1}' | egrep ${{steps.config_kernel.outputs.prop}})
jupyter-nbconvert --to notebook --ExecutePreprocessor.kernel_name="$v" --inplace --execute ${{steps.config_file.outputs.prop}}
cp ${{steps.config_file.outputs.prop}} /tmp
- name: Commit
run: |
ls
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git rm \* ':!${{steps.config_file.outputs.prop}}'
git add ${{steps.config_file.outputs.prop}}
git commit -m 'update'
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: preview
force: true
on-failure:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'eds-book-gallery' && github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Check conditions meet
run: echo 'The triggering workflow failed'