Update latex.yml #75
This file contains 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 and Deploy CV to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Node.js 20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up LaTeX environment | |
uses: xu-cheng/latex-action@v3 | |
with: | |
root_file: CV.tex | |
latexmk_use_lualatex: true | |
root: . | |
- name: Commit and Push changes to main branch | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add CV.pdf | |
git commit -m "Update CV.pdf" | |
# Fetch the latest changes from the main branch before pushing | |
git pull origin main --rebase || echo "Merge failed, proceed with rebase" | |
git push origin main | |
- name: Set up SSH for GitHub Actions using deploy key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Add Remote for Private Repository | |
run: | | |
git remote add private-repo [email protected]:nsswifter/AcademicApplicationDocuments.git | |
- name: Create a new branch for the PR | |
run: | | |
# Create a new branch to push changes before creating the PR | |
git checkout -b update-cv | |
git add . | |
git commit -m "Update CV Repository" | |
git push --set-upstream origin update-cv | |
- name: Create a Pull Request to the Private Repository | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-d '{ | |
"title": "Update CV Repository", | |
"head": "update-cv", | |
"base": "main", | |
"body": "Automated PR to update CV" | |
}' \ | |
https://api.github.com/repos/nsswifter/AcademicApplicationDocuments/pulls |