-
Notifications
You must be signed in to change notification settings - Fork 8
58 lines (47 loc) · 1.73 KB
/
build-docs.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
name: workshop notebooks
on:
push:
branches:
- '20*'
- '!master'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout phoebe2-workshop (current branch)
uses: actions/checkout@v2
with:
path: phoebe2-workshop-branch
- name: Checkout phoebe2-workshop master
uses: actions/checkout@v2
with:
repository: phoebe-project/phoebe2-workshop
ref: master
path: phoebe2-workshop-master
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pip requirements
run: |
python -m pip install --upgrade pip
pip install jupyter
- name: Set branch env var
run: |
echo "branch=`echo ${{ github.ref }} | cut -d "/" -f 3`" >> $GITHUB_ENV
- name: Build notebooks
run: |
cd phoebe2-workshop-branch
mkdir -p ../phoebe2-workshop-master/${{ env.branch }}
jupyter nbconvert --to python ./*ipynb --output-dir=../phoebe2-workshop-master/${{ env.branch }}
cp ./*ipynb ../phoebe2-workshop-master/${{ env.branch }}/
cd ../phoebe2-workshop-master
- name: Commit to master branch
run: |
cd phoebe2-workshop-master
git config --global user.email "gh-actions"
git config --global user.name "gh-actions"
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
git add ${{ env.branch }}/*
git diff-index --quiet HEAD || git commit -m "building ${{ env.branch }} notebooks" -m "automatically generated by github build-docs action"
git push -q -f https://kecnry:${{ secrets.GH_API_KEY }}@github.com/phoebe-project/phoebe2-workshop master