forked from qiskit-community/quantum-prototype-template
-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (67 loc) · 2.04 KB
/
citation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Citation preview
on:
push:
branches: [ main ]
paths: ['CITATION.bib', '.github/workflows/citation.yml']
pull_request:
branches: [ main ]
paths: ['CITATION.bib', '.github/workflows/citation.yml']
jobs:
build-preview:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Check for non-ASCII characters
run: |
# Fail immediately if there are any non-ASCII characters in
# the BibTeX source. We prefer "escaped codes" rather than
# UTF-8 characters in order to ensure the bibliography will
# display correctly even in documents that do not contain
# \usepackage[utf8]{inputenc}.
if [ -f "CITATION.bib" ]; then
python3 -c 'open("CITATION.bib", encoding="ascii").read()'
fi
- name: Install LaTeX
run: |
if [ -f "CITATION.bib" ]; then
sudo apt-get update
sudo apt-get install -y texlive-latex-base texlive-publishers
fi
- name: Run LaTeX
run: |
if [ -f "CITATION.bib" ]; then
arr=(${GITHUB_REPOSITORY//\// })
REPO=${arr[1]}
export PROTOTYPE=${REPO#"prototype-"}
cat <<- EOF > preview.tex
\documentclass[preprint,aps,physrev,notitlepage]{revtex4-2}
\usepackage{hyperref}
\begin{document}
\title{\texttt{$PROTOTYPE} BibTeX test}
\maketitle
\noindent
\texttt{$PROTOTYPE}
\cite{$PROTOTYPE}
\bibliography{CITATION}
\end{document}
EOF
pdflatex preview
fi
- name: Run BibTeX
run: |
if [ -f "CITATION.bib" ]; then
bibtex preview
fi
- name: Re-run LaTeX
run: |
if [ -f "CITATION.bib" ]; then
pdflatex preview
pdflatex preview
fi
- name: Upload PDF
if: always()
uses: actions/upload-artifact@v3
with:
name: preview.pdf
path: preview.pdf