Skip to content

Instantly share code, notes, and snippets.

@michidk
Last active April 7, 2021 13:03
Show Gist options
  • Save michidk/7e5becebb0ab64f325582749f2289f56 to your computer and use it in GitHub Desktop.
Save michidk/7e5becebb0ab64f325582749f2289f56 to your computer and use it in GitHub Desktop.
GitHub deploy to branch
name: Deploy LaTeX document
on:
push:
branches:
- master
jobs:
build_resume:
runs-on: ubuntu-latest
steps:
- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup Git Client
run: |
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git config --global user.email "github-actions@doesnotmatter.dev"
git config --global user.name "GitHub Actions"
- name: Set up Git repository
uses: actions/checkout@v1
- name: Compile LaTeX document
uses: xu-cheng/latex-action@master
with:
root_file: resume.tex
args: -xelatex -file-line-error -interaction=nonstopmode -outdir=out
- name: Collect artifacts
run: |
mkdir dist
cp out/*.pdf dist/
- name: Push artifacts
run: |
git clone --depth 1 --single-branch -b deploy git@github.com:yourname/yourrepo.git deploy
mv deploy/.git deploy-.git
rm -rf deploy
mkdir deploy
mv deploy-.git deploy/.git
cd deploy
cp -R ../dist/* .
git add .
git diff --staged --quiet || git commit -m "Update Artifacts"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment