This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (58 loc) · 1.82 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: publish
on:
# Trigger the workflow on push to main/master branch
push:
branches:
- master
- main
# This job installs dependencies, build the jupyter notebook, and pushes it to `render`, a new `branch`
jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up conda and dependencies
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: repo
environment-file: environment.yml
# Install extra packages
- name: Install jupyter dependencies
run: |
conda install pip
pip install jinja2==3.0.2
pip install jupyter
pip install nbconvert
# Set notebook anme
- name: Get properties from the config file
id: config_file
uses: notiz-dev/github-action-json-property@release
with:
path: 'config.json'
prop_path: 'notebook_name'
# Render the notebook
- name: Render the notebook
run: |
jupyter nbconvert --to notebook --ExecutePreprocessor.kernel_name=python3 --inplace --execute ${{steps.config_file.outputs.prop}}
- name: Commit
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git rm \* ':!*.ipynb'
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: render
force: true