images fix test again #16
This file contains hidden or 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
| name: Build Professional Preprint | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build-paper: | |
| runs-on: ubuntu-latest | |
| name: Build Preprint PDF | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install apt packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pandoc texlive texlive-latex-extra texlive-fonts-recommended texlive-xetex texlive-fonts-extra zip python3-yaml | |
| - name: Extract Metadata and Build LaTeX Title | |
| run: | | |
| python3 - << 'PYEOF' | |
| import yaml | |
| import os | |
| # Ensure we are reading the correct path | |
| file_path = 'paper/paper.md' | |
| if not os.path.exists(file_path): | |
| # Fallback for different repo structures | |
| file_path = 'paper.md' | |
| with open(file_path, 'r') as f: | |
| content = f.read() | |
| parts = content.split('---\n') | |
| fm = yaml.safe_load(parts[1]) | |
| authors = fm.get('authors', []) | |
| affiliations = fm.get('affiliations', []) | |
| aff_map = {str(a['index']): a for a in affiliations} | |
| # 1. Generate Pandoc Metadata | |
| meta = { | |
| 'title': fm.get('title', ''), | |
| 'date': str(fm.get('date', '')), | |
| 'colorlinks': True, | |
| 'linkcolor': 'blue', | |
| 'urlcolor': 'blue', | |
| 'citecolor': 'blue', | |
| 'geometry': 'a4paper, margin=2.5cm', | |
| } | |
| with open('/tmp/pandoc_meta.yaml', 'w') as f: | |
| yaml.dump(meta, f) | |
| # 2. Build LaTeX Title Block | |
| lines = [r'\begin{center}'] | |
| lines.append(r'{\LARGE\bfseries ' + fm.get('title','').replace('&', r'\&') + r'}\\[1.2em]') | |
| auth_line = [] | |
| for a in authors: | |
| name = a['name'].replace('&', r'\&') | |
| aff_indices = str(a.get('affiliation', '')).split(',') | |
| marker = ",".join([idx.strip() for idx in aff_indices]) | |
| if a.get('corresponding'): | |
| marker += r",*" | |
| auth_line.append(rf'{name}$^{{{marker}}}$') | |
| lines.append(r'\large ' + r', '.join(auth_line) + r'\\[0.8em]') | |
| for idx, aff in sorted(aff_map.items()): | |
| name = aff['name'].replace('&', r'\&') | |
| ror_id = aff.get('ror', '') | |
| ror_link = rf" \small (ROR: \href{{https://ror.org/{ror_id}}}{{{ror_id}}})" if ror_id else "" | |
| lines.append(rf'$^{{{idx}}}$\small {name}{ror_link}\\[0.2em]') | |
| corres = [a for a in authors if a.get('corresponding') and a.get('email')] | |
| if corres: | |
| email = corres[0]['email'] | |
| lines.append(rf'\small $^*$Corresponding author: \href{{mailto:{email}}}{{{email}}}\\[0.2em]') | |
| # Zenodo DOI Integration | |
| lines.append(r'\small DOI: \href{https://doi.org/10.5281/zenodo.18377216}{10.5281/zenodo.18377216}\\[0.2em]') | |
| lines.append(r'\small ' + str(fm.get('date',''))) | |
| lines.append(r'\end{center}') | |
| lines.append(r'\vspace{0.5em}\noindent\rule{\textwidth}{0.6pt}\vspace{1.5em}') | |
| with open('/tmp/title_block.tex', 'w') as f: | |
| f.write('\n'.join(lines)) | |
| PYEOF | |
| - name: Create Professional Header | |
| run: | | |
| cat > /tmp/header.tex << 'EOF' | |
| \usepackage{hyperref} | |
| \usepackage{xurl} | |
| \usepackage{fontspec} | |
| \setmainfont{TeX Gyre Termes} | |
| \usepackage{unicode-math} | |
| \setmathfont{TeX Gyre Termes Math} | |
| \usepackage{fancyhdr} | |
| \usepackage{xcolor} | |
| \hypersetup{ | |
| breaklinks=true, | |
| colorlinks=true, | |
| linkcolor=blue, | |
| urlcolor=blue, | |
| citecolor=blue, | |
| pdfauthor={Deshmukh and Mukherjee}, | |
| pdftitle={PICA: High-Precision Automation} | |
| } | |
| \pagestyle{fancy} | |
| \fancyhf{} | |
| \fancyhead[L]{\small \textbf{\textcolor{gray}{PREPRINT -- NOT PEER REVIEWED}}} | |
| \fancyhead[R]{\small \textit{PICA: Advanced Transport Automation}} | |
| \fancyfoot[C]{\thepage} | |
| \renewcommand{\headrulewidth}{0.4pt} | |
| \renewcommand{\maketitle}{} | |
| EOF | |
| - name: Generate Publication-Ready PDF | |
| run: | | |
| # Detect directory | |
| TARGET_DIR="paper" | |
| if [ ! -d "$TARGET_DIR" ]; then TARGET_DIR="."; fi | |
| cd $TARGET_DIR | |
| pandoc paper.md -o paper.pdf \ | |
| --standalone \ | |
| --citeproc \ | |
| --pdf-engine=xelatex \ | |
| --metadata-file=/tmp/pandoc_meta.yaml \ | |
| --include-in-header=/tmp/header.tex \ | |
| --include-before-body=/tmp/title_block.tex \ | |
| --variable=link-citations=true | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: professional-preprint | |
| path: | | |
| paper/paper.pdf | |
| paper.pdf |