Skip to content

Instantly share code, notes, and snippets.

@huwan
Forked from adujardin/bitbucket-pipelines.yml
Last active April 15, 2018 03:50
Show Gist options
  • Save huwan/171ace215b09e9e63b55d0c838b36cbc to your computer and use it in GitHub Desktop.
Save huwan/171ace215b09e9e63b55d0c838b36cbc to your computer and use it in GitHub Desktop.
Bitbucket pipeline file for latex document (including bibtex and upload to 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
- 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"
- mv "$TEX_FILE.pdf" "$TEX_FILE-$DATE-$ID.pdf"
- ./dropbox_uploader.sh -f .dropbox_uploader upload "$TEX_FILE-$DATE-$ID.pdf" .
@huwan
Copy link
Author

huwan commented Apr 15, 2018

Thanks @adujardin!

Some minor changes (for self use):

  1. Change image: fermiumlabs/latex-docker:latest to image: wanhu/texlive-basic:latest. This saved me a lot of "build minutes" (~3 min 25 sec -> ~25 sec).
  2. Change 'custom' to 'default', the build is triggered automatically on every push.
  3. Set TEX_FILE as an environment variable.
  4. Rename output file name (including date and short git commit id).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment