Build publications, CV, and deploy site #8
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 publications, CV, and deploy site | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - "bibliography/publications.bib" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - "bibliography/publications.bib" | |
| workflow_dispatch: | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| cache-dependency-path: requirements-publications.txt | |
| - name: Install Python dependencies | |
| run: python -m pip install --requirement requirements-publications.txt | |
| - name: Install LuaLaTeX for the tagged CV | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --yes --no-install-recommends \ | |
| fonts-liberation2 \ | |
| texlive-latex-extra \ | |
| texlive-luatex | |
| - name: Generate publication records | |
| run: python scripts/build_publications.py --strict | |
| - name: Generate and compile the CV | |
| run: python scripts/build_cv.py --strict --compile | |
| - name: Run repository tests | |
| run: python -m unittest discover -s tests -v | |
| - name: Require generated files to be committed in pull requests | |
| if: github.event_name == 'pull_request' | |
| shell: bash | |
| run: | | |
| if [[ -n "$(git status --porcelain -- _papers pub.bib cv/generated)" ]]; then | |
| git status --short -- _papers pub.bib cv/generated | |
| echo "Generated publication or CV source files are not current. Run make publications and make cv-source, then commit the result." | |
| exit 1 | |
| fi | |
| - name: Commit regenerated publication and CV files | |
| if: github.event_name == 'push' | |
| shell: bash | |
| run: | | |
| git add --all -- _papers pub.bib cv/generated assets/ABoyle_CV.pdf | |
| if git diff --cached --quiet; then | |
| echo "Publication and CV files are already current." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit -m "Update generated publications and CV [skip ci]" | |
| git push origin "HEAD:${GITHUB_REF_NAME}" | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Build Jekyll site | |
| uses: actions/jekyll-build-pages@v1 | |
| with: | |
| source: ./ | |
| destination: ./_site | |
| verbose: true | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: ./_site | |
| deploy: | |
| if: github.event_name != 'pull_request' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |