-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (48 loc) · 1.5 KB
/
push_to_overleaf.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
name: 'Push plots to Overleaf'
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Overleaf project
run: |
cd ${{ github.workspace }}
cd ..
git clone ${{ secrets.OVERLEAF_GIT_CLONE_URL }} overleaf/
- name: Checkout python project on Github
uses: actions/checkout@v4
- name: Cache dependency
id: cache-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies and labproject
run: |
cd ${{ github.workspace }}
python3 -m pip install --upgrade pip
pip install -e ".[docs]"
- name: Run experiments and generate plots
run: |
cd ${{ github.workspace }}
python3 labproject/run.py
cd ..
cp labproject/plots/* overleaf/figures/
- name: Commit and push changes to Overleaf
run: |
cd ${{ github.workspace }}
cd ../overleaf/
git config --global user.name "Github Actions"
git config --global user.email ""
git add figures/
if [ -z "$(git status --untracked-files=no --porcelain)" ]; then
echo "No changes to commit";
else
git commit -m "Update figures automatically"
git push
fi