First commit #1
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Compile Latex and Publish to Pages | |
on: | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build_latex_and_deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: latex | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v3 | |
- name: Compile LaTeX document | |
uses: xu-cheng/latex-action@v3 | |
with: | |
root_file: main.tex | |
latexmk_use_xelatex: true | |
latexmk_shell_escape: true | |
- name: Generate redirect page | |
run: | | |
mkdir public | |
mv main.pdf ./public/ | |
cat > ./public/index.html <<EOL | |
<!doctype html> | |
<html> | |
<head> | |
<meta http-equiv="refresh" content="0;url=./main.pdf" /> | |
<title>Wait for redirect!</title> | |
</head> | |
<body> | |
<p><a href="./main.pdf">You should've been redirected to here :P</a></p> | |
</body> | |
</html> | |
EOL | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./public | |
deploy: | |
needs: build_latex_and_deploy | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action |