Skip to content

Commit

Permalink
feat(cover_letter): introduce cover letter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Chu authored and chujimmy committed Jun 11, 2021
1 parent f281ea1 commit d983f87
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 18 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/generate-cv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,53 @@ jobs:
id: output_set
run: |
echo "::set-output name=file_date::$(date +'%Y_%m_%d')"
echo "::set-output name=file_pattern::$(docker exec cv bash -c 'echo $FILE_PATTERN')"
echo "::set-output name=cv_file_pattern::$(docker exec cv bash -c 'echo $CV_FILE_PATTERN')"
echo "::set-output name=letter_file_pattern::$(docker exec cv bash -c 'echo $LETTER_FILE_PATTERN')"
echo "::set-output name=first_name::$(docker exec cv bash -c 'echo $FIRST_NAME')"
echo "::set-output name=last_name::$(docker exec cv bash -c 'echo $LAST_NAME')"
echo "::set-output name=output_folder::$(docker exec cv bash -c 'echo $OUTPUT_FOLDER')"
- name: Generate CV
id: cv_generate
- name: Generate files
id: file_generate
run: >
FILE_PATTERN=${{ steps.output_set.outputs.file_pattern}} &&
counter=0 &&
while [[ $(find . -regextype sed -regex ".*/lang/[a-z]\{2\}/cv.tex" | wc -l ) -gt $(find . -name "$FILE_PATTERN.pdf" | wc -l ) && $counter -le 60 ]]; do
echo "Waiting for pdf files to be generated..."
((counter++))
CV_FILE_PATTERN=${{ steps.output_set.outputs.cv_file_pattern}} &&
LETTER_FILE_PATTERN=${{ steps.output_set.outputs.letter_file_pattern}} &&
cv_counter=0 &&
while [[ $(find . -regextype sed -regex ".*/lang/[a-z]\{2\}/cv.tex" | wc -l ) -gt $(find . -name "$CV_FILE_PATTERN.pdf" | wc -l ) && $cv_counter -le 60 ]]; do
echo "Waiting for CVs pdf files to be generated..."
((cv_counter++))
sleep 1
done &&
letter_counter=0 &&
while [[ $(find . -regextype sed -regex ".*/lang/[a-z]\{2\}/letter.tex" | wc -l ) -gt $(find . -name "$LETTER_FILE_PATTERN.pdf" | wc -l ) && $letter_counter -le 60 ]]; do
echo "Waiting for cover letters pdf files to be generated..."
((letter_counter++))
sleep 1
done &&
if [[ $counter -gt 30 ]]; then
echo "Timeout while waiting pdf files to be generated. Abort"
exit 1
fi
- name: Prepare CV
id: cv_prepare
- name: Prepare File
id: file_prepare
run: >
mkdir -p ${{ steps.output_set.outputs.output_folder}} &&
FILE_PATTERN=${{ steps.output_set.outputs.file_pattern}} &&
CV_FILE_PATTERN=${{ steps.output_set.outputs.cv_file_pattern}} &&
LETTER_FILE_PATTERN=${{ steps.output_set.outputs.letter_file_pattern}} &&
FULL_NAME=${{ steps.output_set.outputs.first_name}}_${{ steps.output_set.outputs.last_name}} &&
find . -name "$FILE_PATTERN.pdf" | while read FILE_NAME; do
[[ $FILE_NAME =~ .*/([a-z]*)/$FILE_PATTERN.pdf ]]
find . -name "$CV_FILE_PATTERN.pdf" | while read FILE_NAME; do
[[ $FILE_NAME =~ .*/([a-z]*)/$CV_FILE_PATTERN.pdf ]]
LANG=${BASH_REMATCH[1]}
NEW_FILE_NAME="${LANG}_${CV_FILE_PATTERN}_${FULL_NAME}_${{ steps.output_set.outputs.file_date }}.pdf"
cp $FILE_NAME ./${{ steps.output_set.outputs.output_folder}}/${NEW_FILE_NAME,,}
done &&
find . -name "$LETTER_FILE_PATTERN.pdf" | while read FILE_NAME; do
[[ $FILE_NAME =~ .*/([a-z]*)/$LETTER_FILE_PATTERN.pdf ]]
LANG=${BASH_REMATCH[1]}
NEW_FILE_NAME="${FILE_PATTERN}_${FULL_NAME}_${LANG}_${{ steps.output_set.outputs.file_date }}.pdf"
NEW_FILE_NAME="${LANG}_${LETTER_FILE_PATTERN}_${FULL_NAME}_${{ steps.output_set.outputs.file_date }}.pdf"
cp $FILE_NAME ./${{ steps.output_set.outputs.output_folder}}/${NEW_FILE_NAME,,}
done
- name: Upload CV to Artifact
id: cv_upload_artifact
- name: Upload File to Artifact
id: file_upload_artifact
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v2
with:
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,15 @@ add-cv:
.PHONY: remove-cv
remove-cv:
$(call check_lang)
rm -rf ./src/cv/$(LANG_LOWER)/
rm -rf ./src/cv/lang/$(LANG_LOWER)/

.PHONY: add-letter
add-letter:
$(call check_lang)
mkdir ./src/letter/lang/$(LANG_LOWER)/
cp -a ./src/template/letter/. ./src/letter/lang/$(LANG_LOWER)/

.PHONY: remove-letter
remove-letter:
$(call check_lang)
rm -rf ./src/letter/lang/$(LANG_LOWER)/
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ services:
command: "/data/cv/entrypoint.sh"
working_dir: /data/cv/
environment:
FILE_PATTERN: "cv"
CV_FILE_PATTERN: "cv"
LETTER_FILE_PATTERN: "letter"
FIRST_NAME: "john"
LAST_NAME: "doe"
OUTPUT_FOLDER: "output"
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ find . -regextype sed -regex ".*/cv/lang/[a-z]\{2\}/cv.tex" | while read fname;
latexmk -pdf -pvc -file-line-error -view=none -interaction=nonstopmode -recorder -cd $fname > /proc/1/fd/1 2>/proc/1/fd/2 &
done

find . -regextype sed -regex ".*/letter/lang/[a-z]\{2\}/letter.tex" | while read fname; do
latexmk -C -cd $fname
# Could use -interaction=batchmode which seems intended for automated scripts?
latexmk -pdf -pvc -file-line-error -view=none -interaction=nonstopmode -recorder -cd $fname > /proc/1/fd/1 2>/proc/1/fd/2 &
done

tail -f /dev/null
6 changes: 6 additions & 0 deletions src/letter/common/letter_common_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
\input{../../../letter/common/letter_override}
\input{../../../letter/common/package}

\input{../../../common/sections/header}
\input{../../../common/style/spacing}
\input{../../../common/style/symbol}
31 changes: 31 additions & 0 deletions src/letter/common/letter_override.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
\newcommand*{\setCompanyName}[1]{\newcommand*{\companyName}{#1~}}
\newcommand*{\setCompanyPosition}[1]{\newcommand*{\companyPosition}{#1~}}
\newcommand*{\setCompanyInfo}[4]{\newcommand*{\companyInfo}{#1\\#2\\#3\\#4}}

\renewcommand*{\addressfont}{\small\mdseries}

\makeatletter
\renewcommand*{\makeletterhead}{
\begin{minipage}{1\textwidth}
\if@details\raggedright\addressfont{
{\bfseries\upshape\@firstname~\@lastname}\@firstdetailselementfalse
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}
}\fi
\end{minipage}
\\[1em]

\begin{minipage}[t]{1\textwidth}
\raggedleft\addressfont
{\bfseries\upshape\@recipientname}\\
\@recipientaddress
\end{minipage}
\\[2em]

\raggedleft
\today
\\[2em]
\raggedright
}
\makeatother
4 changes: 4 additions & 0 deletions src/letter/common/package.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{ragged2e}
\usepackage{xcolor}
50 changes: 50 additions & 0 deletions src/letter/lang/en/letter.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}

\usepackage[margin=2.25cm]{geometry}
\usepackage[english]{babel}
\input{../../../letter/common/letter_common_main}

\setCompanyName{Company Name}
\setCompanyPosition{Applied Position}
\setCompanyInfo{\companyName}{57 Rue de Varenne}{75007 Paris}{France}
\nopagenumbers

% Override address so country is on it own line, as it should be on letters
% On common, country was put on the same line to save space
\address{55-57 Rue du Faubourg-Saint-Honoré}{75008 Paris}{France}

\recipient{A l'attention des ressources humaines}{\companyInfo}

\begin{document}
\makelettertitle

Subject~:~\companyPosition at \companyName
\customMarginExtraLarge

Greating,
\customMarginExtraLarge

% Justify body text
\justifying

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.

\customMarginExtraLarge

Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.
\customMarginExtraLarge

Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.
\customMarginExtraLarge

Aliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet
\customMarginExtraLarge

Lorem ipsum dolor sit amet. Qui autem qudos qui quas mollitia ut quibusdam iure quo fugit incidunt? Cum sunt reiciendis est unde natus qui odit sunt in nisi beatae ab doloribus voluptatem. Id inventore totam eum quas ullam vel quaerat tempore. Sed esse deserunt ad dolore reiciendis et repellat dolorem qui reiciendis.

% Move name for signature right of the document
\raggedleft
\customMarginExtraLarge

\end{document}
50 changes: 50 additions & 0 deletions src/letter/lang/fr/letter.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}

\usepackage[margin=2.25cm]{geometry}
\usepackage[french]{babel}
\input{../../../letter/common/letter_common_main}

\setCompanyName{Company Name}
\setCompanyPosition{Applied Position}
\setCompanyInfo{\companyName}{57 Rue de Varenne}{75007 Paris}{France}
\nopagenumbers

% Override address so country is on it own line, as it should be on letters
% On common, country was put on the same line to save space
\address{55-57 Rue du Faubourg-Saint-Honoré}{75008 Paris}{France}

\recipient{A l'attention des ressources humaines}{\companyInfo}

\begin{document}
\makelettertitle

Subject~:~\companyPosition at \companyName
\customMarginExtraLarge

Greating,
\customMarginExtraLarge

% Justify body text
\justifying

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.

\customMarginExtraLarge

Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.
\customMarginExtraLarge

Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.
\customMarginExtraLarge

Aliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet
\customMarginExtraLarge

Lorem ipsum dolor sit amet. Qui autem qudos qui quas mollitia ut quibusdam iure quo fugit incidunt? Cum sunt reiciendis est unde natus qui odit sunt in nisi beatae ab doloribus voluptatem. Id inventore totam eum quas ullam vel quaerat tempore. Sed esse deserunt ad dolore reiciendis et repellat dolorem qui reiciendis.

% Move name for signature right of the document
\raggedleft
\customMarginExtraLarge

\end{document}
50 changes: 50 additions & 0 deletions src/template/letter/letter.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}

\usepackage[margin=2.25cm]{geometry}
\usepackage[english]{babel}
\input{../../../letter/common/letter_common_main}

\setCompanyName{Company Name}
\setCompanyPosition{Applied Position}
\setCompanyInfo{\companyName}{57 Rue de Varenne}{75007 Paris}{France}
\nopagenumbers

% Override address so country is on it own line, as it should be on letters
% On common, country was put on the same line to save space
\address{55-57 Rue du Faubourg-Saint-Honoré}{75008 Paris}{France}

\recipient{A l'attention des ressources humaines}{\companyInfo}

\begin{document}
\makelettertitle

Subject~:~\companyPosition at \companyName
\customMarginExtraLarge

Greating,
\customMarginExtraLarge

% Justify body text
\justifying

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.

\customMarginExtraLarge

Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.
\customMarginExtraLarge

Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.
\customMarginExtraLarge

Aliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet
\customMarginExtraLarge

Lorem ipsum dolor sit amet. Qui autem qudos qui quas mollitia ut quibusdam iure quo fugit incidunt? Cum sunt reiciendis est unde natus qui odit sunt in nisi beatae ab doloribus voluptatem. Id inventore totam eum quas ullam vel quaerat tempore. Sed esse deserunt ad dolore reiciendis et repellat dolorem qui reiciendis.

% Move name for signature right of the document
\raggedleft
\customMarginExtraLarge

\end{document}

0 comments on commit d983f87

Please sign in to comment.