Update GitHub Actions workflow for professional preprint #11
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 | |
| with open('paper/paper.md', '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','') + r'}\\[1.2em]') | |
| auth_line = [] | |
| for a in authors: | |
| name = a['name'] | |
| 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 aff_map.items(): | |
| ror_id = aff.get('ror', '') | |
| # Link ROR IDs for professional institutional verification | |
| ror_link = rf" \small (ROR: \href{{https://ror.org/{ror_id}}}{{{ror_id}}})" if ror_id else "" | |
| lines.append(rf'$^{{{idx}}}$\small {aff["name"]}{ror_link}\\[0.2em]') | |
| corres = [a['email'] for a in authors if a.get('corresponding') and a.get('email')] | |
| if corres: | |
| lines.append(rf'\small $^*$Corresponding author: \href{{mailto:{corres[0]}}}{{{corres[0]}}}\\[0.2em]') | |
| # Explicit Zenodo DOI for the PICA suite | |
| 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{xurl} | |
| \usepackage{fontspec} | |
| \setmainfont{TeX Gyre Termes} | |
| \usepackage{unicode-math} | |
| \setmathfont{TeX Gyre Termes Math} | |
| \usepackage{fancyhdr} | |
| \usepackage{xcolor} | |
| \pagestyle{fancy} | |
| \fancyhf{} | |
| % Clear identification as a preprint while maintaining professional style | |
| \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}{} | |
| \hypersetup{ | |
| breaklinks=true, | |
| pdfauthor={Deshmukh and Mukherjee}, | |
| pdftitle={PICA: High-Precision Automation} | |
| } | |
| EOF | |
| - name: Generate Publication-Ready PDF | |
| run: | | |
| cd paper | |
| 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 |