build-cv #9
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-cv | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab on GitHub. | |
| workflow_dispatch: | |
| # Trigger the workflow every time you push to the `main` branch | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - src/data/CV-MGarcia.tex | |
| - src/data/biblio.bib | |
| # Allow one concurrent build | |
| concurrency: | |
| group: "cv" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Set up Java | |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set up Nextflow | |
| run: | | |
| export NXF_VER=25.10.4 | |
| curl -fsSL https://get.nextflow.io | bash | |
| sudo mv nextflow /usr/local/bin/nextflow | |
| nextflow -version | |
| - name: Compile latest CV | |
| run: nextflow run maxulysse/compile-latex -r 3.0.1 -profile docker --outdir . --github_avatar 'https://avatars.githubusercontent.com/u/1019628?s=300&v=4' --input src/data/CV-MGarcia.tex --outname CV-MGarcia-latest.pdf --biblio src/data/biblio.bib | |
| - name: Upload CV artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: cv-latest-pdf | |
| path: CV-MGarcia-latest.pdf | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Download CV artifact | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: cv-latest-pdf | |
| path: . | |
| - name: Deploy to cv branch | |
| if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git checkout -B cv | |
| git add -f CV-MGarcia-latest.pdf | |
| if git diff --staged --quiet; then | |
| echo "No CV changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "Update CV - $(date +%Y-%m-%d)" | |
| git push -f origin cv |