update c2st fig1 notebook #99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Push plots to Overleaf, Github Pages' | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Clean up before run (delete repositories) | |
run: | | |
cd ${{ github.workspace }} | |
cd .. | |
rm -rf overleaf/ | |
rm -rf github/ | |
- 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 | |
if: "contains(runner.name, 'GitHub Actions')" | |
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,dev]" | |
- name: Check formatting | |
run: | | |
cd ${{ github.workspace }} | |
black --check labproject/ | |
- name: Run experiments and generate plots | |
shell: bash | |
run: | | |
cd ${{ github.workspace }} | |
shopt -s nullglob | |
for script in run_*.py; do | |
python "$script" | |
done | |
- name: Commit and push changes to Overleaf | |
run: | | |
cd ${{ github.workspace }} | |
cd .. | |
cp -r labproject/plots overleaf/figures/ | |
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 | |
# New step to build the MkDocs site | |
- name: Build MkDocs Site | |
run: | | |
cd ${{ github.workspace }} | |
mkdocs build | |
# New step to deploy to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site |