overleaf sync #52
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: overleaf sync | |
on: | |
schedule: | |
- cron: "0 0 */7 * *" | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch the latest version from overleaf server | |
uses: subhamx/overleaf_sync_with_git@master | |
with: | |
OVERLEAF_PROJECT_ID: ${{ secrets.OVERLEAF_PROJECT_ID }} | |
OVERLEAF_COOKIE: ${{ secrets.OVERLEAF_COOKIE }} | |
- name: Upload to Project Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: project | |
path: artifacts/ | |
- name: Compile resume | |
uses: xu-cheng/latex-action@v2 | |
with: | |
working_directory: artifacts/ | |
root_file: main.tex | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
path: repo/ | |
- name: Create or clean directory | |
run: | | |
cd repo | |
if [ -d "overleaf_remote_src" ]; then rm -rf overleaf_remote_src/*; | |
else mkdir overleaf_remote_src; fi | |
- name: Commit resume | |
run: | | |
cd repo | |
cp -r ../artifacts/* overleaf_remote_src | |
mv overleaf_remote_src/main.pdf Wei_Chun_Tan_Resume.pdf | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add . | |
if [[ $(git diff HEAD --stat) == '' ]]; then (echo 'working tree is clean') | |
else (git commit -m "sync with overleaf remote" && git push) fi |