this sucks #21
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: Generate Resume & Create Release | ||
on: | ||
push: | ||
paths: | ||
- "resume/**" # Trigger when files in the resume directory are updated | ||
workflow_dispatch: | ||
jobs: | ||
build-and-release: | ||
name: Build Resume and Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Generate PDF, DOCX, and TXT | ||
run: | | ||
DATE=$(date +"%Y-%m-%d") | ||
mkdir -p resume/output | ||
# Build PDF using XeLaTeX | ||
docker run --rm \ | ||
-v ${PWD}:/workspace -w /workspace \ | ||
docker.io/danpilch/cv-build:v5 \ | ||
xelatex -jobname=danpilch-resume-${DATE} -output-directory=output resume.tex | ||
# Build HTML | ||
docker run --rm \ | ||
-v ${PWD}:/workspace -w /workspace \ | ||
docker.io/danpilch/cv-build:v5 \ | ||
make4ht --utf8 -a debug -B .build -f html5+inlinecss --output-dir ./output/ -l resume.tex "xelatex" | ||
# Set name of html resume | ||
mv ./output/resume.html ./output/danpilch-resume-${DATE}.html | ||
mv ./output/resume.css ./output/danpilch-resume-${DATE}.css | ||
# Build Markdown (requires Pandoc in the container) | ||
sed -E \ | ||
-e 's/\\runsubsection\{([^}]*)\}/\\section{\1}/g' \ | ||
-e 's/\\descript\{\|\s*([^}]*)\}/\\textbf{\1}/g' \ | ||
-e 's/\\location\{([^}]*)\}/\\emph{\1}/g' \ | ||
-e 's/tightemize/itemize/g' \ | ||
-e 's/\\sectionsep//g' \ | ||
resume.tex > resume_tmp.tex | ||
docker run --rm \ | ||
-v ${PWD}:/workspace -w /workspace \ | ||
docker.io/danpilch/cv-build:v5 \ | ||
pandoc -s resume_tmp.tex -o ./output/danpilch-resume-${DATE}.md | ||
- name: Create Unique Git Tag | ||
id: create_tag | ||
run: | | ||
TIMESTAMP=$(date +"%Y-%m-%d-%H%M%S") | ||
TAG="resume-${TIMESTAMP}" | ||
git tag "$TAG" | ||
git push origin "$TAG" | ||
echo "tag_name=$TAG" >> $GITHUB_ENV | ||
- name: Upload All Resumes to Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: ${{ env.tag_name }} | ||
files: | | ||
resume/output/resume-*.pdf | ||
resume/output/resume-*.html | ||
resume/output/resume-*.css | ||
resume/output/resume-*.md | ||
- name: Notify Success | ||
run: echo "PDF, DOCX, and TXT generated and attached to release." |