Skip to content

Instantly share code, notes, and snippets.

@huwan
Created April 24, 2018 12:35
Show Gist options
  • Save huwan/dd4ba626c98aa77db4f1171e710469c7 to your computer and use it in GitHub Desktop.
Save huwan/dd4ba626c98aa77db4f1171e710469c7 to your computer and use it in GitHub Desktop.
Git+LaTeX+gitinfo2+dropbox
# SETTING UP :
# Generate an application token for your dropbox account and set it as environment variable named "DROPBOX_TOKEN"
# - https://blogs.dropbox.com/developers/2014/05/generate-an-access-token-for-your-own-account/
# - https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html
# Set environment variable TEX_FILE according to the main tex file name
image: wanhu/texlive-basic:latest
pipelines:
default:
- step:
script:
- curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
- chmod +x dropbox_uploader.sh ; echo "OAUTH_ACCESS_TOKEN=$DROPBOX_TOKEN" > .dropbox_uploader
- curl "https://raw.githubusercontent.com/Hightor/gitinfo2/CTAN/post-xxx-sample.txt" -o post-checkout
- mkdir -p .git/hooks && chmod +x post-checkout && mv post-checkout .git/hooks
- git checkout master
- DATE=$(date +%Y%m%d)
- ID=$(git rev-parse --short HEAD)
- pdflatex "$TEX_FILE.tex" && bibtex "$TEX_FILE" && pdflatex "$TEX_FILE.tex" && pdflatex "$TEX_FILE.tex"
- cp "$TEX_FILE.pdf" "$TEX_FILE-$DATE-$ID.pdf"
- ./dropbox_uploader.sh -f .dropbox_uploader upload "$TEX_FILE-$DATE-$ID.pdf" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment