Last active
April 7, 2021 13:03
-
-
Save michidk/7e5becebb0ab64f325582749f2289f56 to your computer and use it in GitHub Desktop.
GitHub deploy to branch
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: Deploy LaTeX document | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build_resume: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
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 "[email protected]" | |
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 [email protected]: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