|
1 | | -# This is a basic workflow to help you get started with Actions |
| 1 | +# This is a basic workflow to compile and deploy notebook-classroom |
2 | 2 |
|
3 | | -name: CI |
| 3 | +name: Notebook-Classrom |
4 | 4 |
|
5 | | -# Controls when the action will run. Triggers the workflow on push or pull request |
6 | | -# events but only for the master branch |
| 5 | +# Only run on push to the master branch |
7 | 6 | on: push |
| 7 | +# push: |
| 8 | +# branches: [ master ] |
| 9 | +# schedule: |
| 10 | +# # change this as you need it: https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule |
| 11 | +# # runs at 1:30 every saturday |
| 12 | +# - cron: '30 1 * * 6' |
8 | 13 |
|
9 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 14 | +# Jobs to compile notebook classroom |
10 | 15 | jobs: |
11 | | - # This workflow contains a single job called "build" |
12 | | - build: |
13 | | - # The type of runner that the job will run on |
14 | | - runs-on: ubuntu-latest |
| 16 | + # Publish the application on github pages |
| 17 | + publish: |
| 18 | + # use ubuntu 18.04 |
| 19 | + runs-on: ubuntu-18.04 |
15 | 20 |
|
16 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
17 | 21 | steps: |
18 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
19 | | - - uses: actions/checkout@v2 |
| 22 | + # Checks-out $GITHUB_WORKSPACE |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v2 |
20 | 25 |
|
21 | | - # Runs a single command using the runners shell |
22 | 26 | - name: Install Conda |
23 | 27 | uses: s-weigand/setup-conda@v1.0.2 |
24 | 28 | with: |
25 | 29 | python-version: 3.6 |
26 | 30 |
|
27 | | - - name: install deps |
| 31 | + - name: Install dependencies |
28 | 32 | run: | |
29 | 33 | conda env update -f environment.yml -n base |
30 | | - jupyter nbconvert --to html *.ipynb |
31 | | - ls |
| 34 | + pip install -r ./requirements.txt |
| 35 | + |
| 36 | + # Compile notebooks |
| 37 | + - name: Compile Notebooks |
| 38 | + run: | |
| 39 | + mkdir ./nb |
| 40 | + jupyter nbconvert --to html --output-dir='./nb' *.ipynb |
| 41 | + jupyter nbconvert --to slides --output-dir='./nb' *ipynb |
| 42 | + |
| 43 | + # install latest notebook classroom app |
| 44 | + - name: Install Notebook-classroom |
| 45 | + run: | |
| 46 | + wget https://github.com/hydrocode-de/notebook-classroom/releases/latest/download/notebook-classroom.zip |
| 47 | + unzip ./notebook-classroom.zip -d ./dist |
| 48 | + |
| 49 | + # move all neccessary files |
| 50 | + - name: Copy content |
| 51 | + run: | |
| 52 | + mv ./nb/* ./dist/nb |
| 53 | + mv configuration.js ./dist/configuration.js |
| 54 | + [ -d ./static ] && mv ./static/* ./dist/static/* |
| 55 | + [ -f ./index.md ] && mv index.md ./dist/static/index.md |
| 56 | + [ -d ./img ] && mv ./img ./dist/img |
| 57 | + |
| 58 | + # Deploy to Github Pages |
| 59 | +# - name: Deploy |
| 60 | +# uses: crazy-max/ghaction-github-pages@v1 |
| 61 | +# with: |
| 62 | +# target_branch: gh-pages |
| 63 | +# build_dir: ./dist |
| 64 | +# env: |
| 65 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments