Fri Mar 8 10:49:47 CET 2024 #62
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
# Github workflow to compile latex and deploy the pdf to an orphan branch. | |
# The latest compiled pdf is made available at e.g. | |
# https://github.com/dgerosa/reponame/blob/build/filename.pdf | |
# Davide Gerosa (2021) https://github.com/dgerosa | |
name: writeapaper | |
on: [push] | |
jobs: | |
paper: | |
runs-on: ubuntu-latest | |
env: | |
# Edit here with the names of your latex file and directory (can use ".") | |
DIR: draft | |
FILE: draft | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
#- name: Install TeXlive | |
# run: sudo apt-get update && sudo apt-get install texlive texlive-publishers texlive-science latexmk cm-super | |
#- name: LaTeX compile | |
# working-directory: ${{ env.DIR }} | |
# #run: latexmk -pdf -bibtex ${{ env.FILE }} | |
# run: pdflatex ${{ env.FILE }}; bibtex ${{ env.FILE }}; pdflatex ${{ env.FILE }}; pdflatex ${{ env.FILE }}; | |
- name: LaTeX | |
uses: xu-cheng/texlive-action@v2 | |
with: | |
run: | | |
cd ${{ env.DIR }} | |
pdflatex ${{ env.FILE }} | |
bibtex ${{ env.FILE }} | |
pdflatex ${{ env.FILE }} | |
pdflatex ${{ env.FILE }} | |
- name: move | |
run: | | |
mkdir -p github_artifacts | |
mv ${{ env.DIR }}/${{ env.FILE }}.pdf ./github_artifacts/ | |
- name: Upload pdf as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.FILE }}.pdf | |
path: ./github_artifacts | |
# deploy: | |
# # Edit here if compiling multiple papers | |
# needs: [paper] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - uses: actions/download-artifact@v2 | |
# with: | |
# path: github_artifacts | |
# - name: move | |
# run: | | |
# mkdir -p github_deploy | |
# mv github_artifacts/*/* github_deploy | |
# - name: deploy on orphan branch | |
# uses: peaceiris/actions-gh-pages@v3 | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# publish_dir: ./github_deploy | |
# publish_branch: build | |
# force_orphan: true | |
deploy: | |
# Edit here if compiling multiple papers | |
needs: [paper] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
path: github_artifacts | |
- name: move | |
run: mkdir -p github_deploy && mv github_artifacts/*/* github_deploy | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./github_deploy | |
asset_name: github_deploy | |
clean: | |
needs: [deploy] | |
runs-on: ubuntu-latest | |
steps: | |
- name: delete | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: '*.pdf' |