diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index a6b86df..71e2a5f 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -3,18 +3,18 @@ name: Deploy Resume
on:
push:
branches: [main]
+ pull_request:
+ branches: [main]
workflow_dispatch:
-
-env:
- # These are GitHub Camo image proxy URLs.
- # To obtain them: paste the raw S3 image link into a GitHub Markdown file (README, issue, etc.),
- # let GitHub render it, then right-click → "Copy image address".
- RESUME_IMAGE_URL: "https://camo.githubusercontent.com/19e0bf2e0d1d9b58f0bd2a4bf66b214f817d5ae7e72ff4e3684b8b15522be23f/68747470733a2f2f64616c746f6e2d63762d6172746966616374732e73332e75732d656173742d312e616d617a6f6e6177732e636f6d2f696d616765732f63762e706e67"
- COVER_LETTER_IMAGE_URL: "https://camo.githubusercontent.com/31c147493e3d013bd48fcbeda87b802e2a8012a64faf6dc324f640ba7eec4f24/68747470733a2f2f64616c746f6e2d63762d6172746966616374732e73332e75732d656173742d312e616d617a6f6e6177732e636f6d2f696d616765732f636f7665725f6c65747465722e706e67"
-
jobs:
build-and-deploy:
runs-on: ubuntu-latest
+ container:
+ image: daluce/cv:latest
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: ${{ secrets.AWS_REGION }}
steps:
- name: Checkout source
@@ -22,29 +22,12 @@ jobs:
with:
fetch-depth: 0
- - name: Install dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y make texlive-latex-base texlive-latex-extra imagemagick
-
- name: Build resume
run: make all
- - name: Upload resume to S3
- uses: aws-actions/configure-aws-credentials@v4
- with:
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- aws-region: ${{ secrets.AWS_REGION }}
-
- - name: Copy PDF + images to S3
- run: |
- aws s3 cp dist/pdfs/ s3://${{ secrets.AWS_S3_BUCKET }}/pdfs/ --recursive
- aws s3 cp dist/images/ s3://${{ secrets.AWS_S3_BUCKET }}/images/ --recursive
-
- # Purge GitHub's Camo CDN cache so updated resume/cover letter images show up immediately
- # Docs: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-anonymized-urls#removing-an-image-from-camos-cache
- - name: Clear GitHub Camo cache
- run: |
- curl -X PURGE "${RESUME_IMAGE_URL}"
- curl -X PURGE "${COVER_LETTER_IMAGE_URL}"
+ - name: Test
+ run: make test
+ - name: Upload PDFs and images to S3
+ # Only upload on pushes to main branch, not PRs
+ if: github.event_name == 'push'
+ run: make release
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..dbb0f20
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,27 @@
+name: Build and Push Docker Image
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - 'Dockerfile'
+
+jobs:
+ build-and-push:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Log in to Docker Hub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKER_HUB_USERNAME }}
+ password: ${{ secrets.DOCKER_HUB_PASSWORD }}
+
+ - name: Build and push Docker image
+ uses: docker/build-push-action@v4
+ with:
+ push: true
+ tags: daluce/cv:latest
+ platforms: linux/amd64
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..6529538
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,15 @@
+FROM python:3.11-slim
+
+RUN apt-get update && apt-get install -y \
+ imagemagick \
+ texlive-latex-base \
+ texlive-latex-extra \
+ git \
+ awscli \
+ make \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Install cvlint
+RUN git clone https://github.com/da-luce/cvlint.git
+WORKDIR /cvlint
+RUN pip install .
diff --git a/Makefile b/Makefile
index 7167135..6d7035c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all clean build private cover-letter images help install test
+.PHONY: all clean build private cover-letter images help install test release
# Default target
all: build images
@@ -7,75 +7,82 @@ all: build images
BUILD_DIR := build
DIST_DIR := dist
SRC_DIR := src
+PDF_DIR := $(DIST_DIR)/pdfs
+IMG_DIR := $(DIST_DIR)/images
+CV_NAME := dalton_luce_cv
+COVER_LETTER_NAME := cover_letter
+S3_BUCKET := dalton-cv-artifacts
+AWS_REGION := us-east-1
+
+# These are GitHub Camo image proxy URLs.
+# To obtain them: paste the raw S3 image link into a GitHub Markdown file (README, issue, etc.),
+# let GitHub render it, then right-click → "Copy image address".
+CV_GITHUB_CACHE_URL:= https://camo.githubusercontent.com/19e0bf2e0d1d9b58f0bd2a4bf66b214f817d5ae7e72ff4e3684b8b15522be23f/68747470733a2f2f64616c746f6e2d63762d6172746966616374732e73332e75732d656173742d312e616d617a6f6e6177732e636f6d2f696d616765732f63762e706e67
+COVER_GITHUB_CACHE_URL:= https://camo.githubusercontent.com/31c147493e3d013bd48fcbeda87b802e2a8012a64faf6dc324f640ba7eec4f24/68747470733a2f2f64616c746f6e2d63762d6172746966616374732e73332e75732d656173742d312e616d617a6f6e6177732e636f6d2f696d616765732f636f7665725f6c65747465722e706e67
# Help target
help:
@echo "Available targets:"
- @echo " all - Build CV and cover letter, generate images"
- @echo " build - Build CV (public version)"
- @echo " private - Build CV (private version)"
- @echo " cover-letter - Build cover letter only"
- @echo " images - Generate PNG images from PDFs"
- @echo " clean - Remove build directory"
- @echo " install - Install Python dependencies"
- @echo " test - Run tests"
+ @echo " all - Build CV and cover letter, then generate images"
+ @echo " build - Build public version of the CV"
+ @echo " private - Build private version of the CV"
+ @echo " cover-letter - Build the cover letter PDF"
+ @echo " images - Generate PNG images from PDFs using ImageMagick"
+ @echo " clean - Remove all build and distribution artifacts"
+ @echo " install - Install Python dependencies (not defined here)"
+ @echo " test - Run cvlint on the generated CV PDF"
+ @echo " release - Upload PDFs and images to S3, purge GitHub Camo cache"
# Create necessary directories
-$(DIST_DIR)/pdfs $(DIST_DIR)/images:
+$(PDF_DIR) $(IMG_DIR):
mkdir -p $@
# Build public CV
-build: $(DIST_DIR)/pdfs cover-letter
- mkdir -p $(BUILD_DIR)
- pdflatex -output-directory=$(BUILD_DIR) -jobname=dalton_luce_cv $(SRC_DIR)/cv.tex
- cp $(BUILD_DIR)/dalton_luce_cv.pdf $(DIST_DIR)/pdfs/
+build: $(PDF_DIR) cover-letter
+ mkdir -p $(PDF_DIR)
+ pdflatex -output-directory=$(BUILD_DIR) -jobname=$(CV_NAME) $(SRC_DIR)/$(CV_NAME).tex
+ cp $(BUILD_DIR)/$(CV_NAME).pdf $(PDF_DIR)
# Build private CV
-private: $(DIST_DIR)/pdfs
+private: $(PDF_DIR)
mkdir -p $(BUILD_DIR)
- pdflatex -output-directory=$(BUILD_DIR) -jobname=dalton_luce_cv '\def\private{} \input{$(SRC_DIR)/cv.tex}'
- cp $(BUILD_DIR)/dalton_luce_cv.pdf $(DIST_DIR)/pdfs/
+ pdflatex -output-directory=$(BUILD_DIR) -jobname=$(CV_NAME) "\def\\private{} \input{$(SRC_DIR)/$(CV_NAME).tex}"
+ cp $(BUILD_DIR)/$(CV_NAME).pdf $(PDF_DIR)
# Build cover letter
-cover-letter: $(DIST_DIR)/pdfs
+cover-letter: $(PDF_DIR)
mkdir -p $(BUILD_DIR)
- pdflatex -output-directory=$(BUILD_DIR) -jobname=cover_letter $(SRC_DIR)/cover_letter.tex
- cp $(BUILD_DIR)/cover_letter.pdf $(DIST_DIR)/pdfs/
+ pdflatex -output-directory=$(BUILD_DIR) -jobname=cover_letter $(SRC_DIR)/$(COVER_LETTER_NAME).tex
+ cp $(BUILD_DIR)/$(COVER_LETTER_NAME).pdf $(PDF_DIR)
# Generate images from PDFs
-# FIXME: currently using deprecated "convert" since ubuntu GitHub runners only have access to IMv6
-images: $(DIST_DIR)/images
+images: $(IMG_DIR)
@if command -v convert >/dev/null 2>&1; then \
- convert -density 300 $(DIST_DIR)/pdfs/dalton_luce_cv.pdf -quality 100 -flatten -sharpen 0x1.0 $(DIST_DIR)/images/cv.png; \
- convert -density 300 $(DIST_DIR)/pdfs/cover_letter.pdf -quality 100 -flatten -sharpen 0x1.0 $(DIST_DIR)/images/cover_letter.png; \
+ magick -density 300 $(DIST_DIR)/pdfs/dalton_luce_cv.pdf -quality 100 -flatten -sharpen 0x1.0 $(IMG_DIR)/$(CV_NAME).png; \
+ magick -density 300 $(DIST_DIR)/pdfs/cover_letter.pdf -quality 100 -flatten -sharpen 0x1.0 $(IMG_DIR)/$(COVER_LETTER_NAME).png; \
else \
echo "Imageconvert not found. Please install Imageconvert to generate images."; \
fi
# Clean build directory
clean:
- rm -rf $(BUILD_DIR)
-
-
-# Install Python dependencies in a venv
-install:
- @if [ ! -d .venv ]; then \
- echo "Creating virtual environment..."; \
- python3 -m venv .venv; \
- fi
- @echo "Installing dependencies..."
- @. .venv/bin/activate; \
- if [ -f pyproject.toml ]; then \
- pip install --upgrade pip; \
- pip install -e .; \
- else \
- echo "No dependency file found"; \
- fi
- @echo ""
- @echo "✅ Next steps:"
- @echo " source .venv/bin/activate"
- @echo " (or run commands with .venv/bin/python, e.g. .venv/bin/python -m pytest)"
+ rm -rf $(BUILD_DIR) $(DIST_DIR)
# Run tests
test:
- python -m pytest test/test.py
+ @if ! command -v cvlint >/dev/null 2>&1; then \
+ echo "Error: cvlint is not installed or not in PATH."; \
+ echo "Please install cvlint by following instructions at https://github.com/da-luce/cvlint"; \
+ exit 1; \
+ fi
+ cvlint check $(PDF_DIR)/$(CV_NAME).pdf
+
+release:
+ aws s3 cp $(PDF_DIR)/ s3://$(S3_BUCKET)/pdfs/ --recursive --region $(AWS_REGION)
+ aws s3 cp $(IMG_DIR)/ s3://$(S3_BUCKET)/images/ --recursive --region $(AWS_REGION)
+ # Purge GitHub Camo image cache, so updated images show up in README immediately
+ curl -X PURGE "$(CV_GITHUB_CACHE_URL)"
+ curl -X PURGE "$(COVER_GITHUB_CACHE_URL)"
+
+enter:
+ docker run --rm -it --pull always -v "$$(pwd)":/cv -w /cv daluce/cv:latest /bin/bash
diff --git a/README.md b/README.md
index 93efa20..1e1bd68 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,21 @@
# 📄 CV [](https://github.com/da-luce/cv/actions/workflows/deploy.yml)
+
-
+