Upload Resume to Website #72
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Upload Resume to Website | |
on: | |
# Allows running this workflow from GitHub Actions tab | |
workflow_dispatch: | |
# Run workflow when resume is updated | |
push: | |
branches: main | |
paths: resume.yml | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
env: | |
RESUME_MARGIN: 6 | |
jobs: | |
publish-site: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: pandoc wkhtmltopdf poppler-utils fonts-roboto | |
version: 1.0 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Run resume generation script | |
run: bash resumake.sh ${{ env.RESUME_MARGIN }} | |
- name: Generate PNG preview | |
id: gen-png | |
run: | | |
AUTHOR="$(head -n 1 resume.yml | cut -f 2- -d ' ' | tr ' ' '_')" | |
pdftoppm -png "./static/assets/Resume_${AUTHOR}.pdf" > "./static/assets/Resume_${AUTHOR}.png" | |
echo "author=${AUTHOR}" >> "${GITHUB_OUTPUT}" | |
- name: Generate landing page | |
run: | | |
AUTHOR=${{ steps.gen-png.outputs.author }} | |
echo | pandoc -t html --template=./resources/index.html \ | |
--metadata title="${AUTHOR}" \ | |
--variable author="${AUTHOR}" \ | |
-o ./static/index.html | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./static" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -a -m "pipeline: update resume" | |
- name: Upload resume files | |
uses: ad-m/github-push-action@master | |
with: | |
branch: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} |