diff --git a/.github/workflows/generate-cv.yml b/.github/workflows/generate-cv.yml index 626348c..9f731ab 100644 --- a/.github/workflows/generate-cv.yml +++ b/.github/workflows/generate-cv.yml @@ -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: diff --git a/Makefile b/Makefile index cc0a153..16b67ce 100644 --- a/Makefile +++ b/Makefile @@ -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)/ diff --git a/docker-compose.yml b/docker-compose.yml index f70dd53..079dc50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" diff --git a/entrypoint.sh b/entrypoint.sh index a716f39..0f4d577 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 diff --git a/src/letter/common/letter_common_main.tex b/src/letter/common/letter_common_main.tex new file mode 100644 index 0000000..1252c88 --- /dev/null +++ b/src/letter/common/letter_common_main.tex @@ -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} diff --git a/src/letter/common/letter_override.tex b/src/letter/common/letter_override.tex new file mode 100644 index 0000000..6373adf --- /dev/null +++ b/src/letter/common/letter_override.tex @@ -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 diff --git a/src/letter/common/package.tex b/src/letter/common/package.tex new file mode 100644 index 0000000..8ab7e8e --- /dev/null +++ b/src/letter/common/package.tex @@ -0,0 +1,4 @@ +\usepackage[utf8]{inputenc} +\usepackage{graphicx} +\usepackage{ragged2e} +\usepackage{xcolor} \ No newline at end of file diff --git a/src/letter/lang/en/letter.tex b/src/letter/lang/en/letter.tex new file mode 100644 index 0000000..631ee9e --- /dev/null +++ b/src/letter/lang/en/letter.tex @@ -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} \ No newline at end of file diff --git a/src/letter/lang/fr/letter.tex b/src/letter/lang/fr/letter.tex new file mode 100644 index 0000000..5477e15 --- /dev/null +++ b/src/letter/lang/fr/letter.tex @@ -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} \ No newline at end of file diff --git a/src/template/letter/letter.tex b/src/template/letter/letter.tex new file mode 100644 index 0000000..631ee9e --- /dev/null +++ b/src/template/letter/letter.tex @@ -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} \ No newline at end of file