MarkdownResume-Pipeline/build/build-pipeline-server-markdown.sh

176 lines
6.2 KiB
Bash
Raw Normal View History

2024-12-09 18:43:23 +00:00
#!/usr/bin/env bash
2024-12-09 18:15:58 +00:00
echo "Cleaning up from previous runs..."
rm $BUILDYAML_CANDIDATEINFOSHEET
rm $CandidateInfoSheetMarkdownOutputFile
rm $CandidateInfoSheetPDFOutputFIle
2024-12-09 20:29:19 +00:00
rm $BUILDYAML_JOBBOARD
rm $JobBoardMarkdownOutputFile
rm $JobBoardPDFOutputFile
rm $JobBoardMSWordOutputFile
rm $BUILDYAML_CLIENTSUBMISSION
rm $ClientSubmissionMarkdownOutputFile
rm $ClientSubmissionPDFOutputFile
rm $ClientSubmissionMSWordOutputFile
2024-12-09 18:43:23 +00:00
#####################################################################################################
#Markdown to PDF/MSWord Resumek and candidate info sheet
#####################################################################################################
# Expand variables into rendered YAML files. These will be used by pandoc to create the output artifacts
2024-12-09 18:15:58 +00:00
2024-12-10 22:37:02 +00:00
$MO_PATH $PipelineClientWorkingDir/build/BuildTemplate-CandidateInfoSheet.yml > $BUILDYAML_CANDIDATEINFOSHEET
$MO_PATH $PipelineClientWorkingDir/build/BuildTemplate-JobBoard.yml > $BUILDYAML_JOBBOARD
$MO_PATH $PipelineClientWorkingDir/build/BuildTemplate-ClientSubmission.yml > $BUILDYAML_CLIENTSUBMISSION
2024-12-09 20:29:19 +00:00
echo "Creating candidate info sheet..."
2024-12-10 22:31:43 +00:00
$MO_PATH $PipelineClientWorkingDir/Templates/CandidateInfoSheet/CandidateInfoSheet.md > $CandidateInfoSheetMarkdownOutputFile
pandoc \
"$CandidateInfoSheetMarkdownOutputFile" \
--template eisvogel \
2024-12-10 22:31:43 +00:00
--metadata-file="$PipelineClientWorkingDir/build-temp/CandidateInfoSheet.yml" \
--from markdown \
--to=pdf \
--output $CandidateInfoSheetPDFOutputFIle
2024-12-09 20:29:19 +00:00
echo "Combining markdown files into single input file for pandoc..."
# Create contact info md file
2024-12-13 17:33:46 +00:00
$MO_PATH "$PipelineClientWorkingDir/Templates/ContactInfo/ContactInfo-JobBoard.md" > "$BUILD_TEMP_DIR/ContactInfo-JobBoard.md"
$MO_PATH "$PipelineClientWorkingDir/Templates/ContactInfo/ContactInfo-ClientSubmit.md" > "$BUILD_TEMP_DIR/ContactInfo-ClientSubmit.md"
2024-12-09 20:29:19 +00:00
#Pull in contact info
2024-12-13 17:33:46 +00:00
cat $BUILD_TEMP_DIR/ContactInfo-JobBoard.md >> "$JobBoardMarkdownOutputFile"
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
cat $BUILD_TEMP_DIR/ContactInfo-ClientSubmit.md >> $ClientSubmissionMarkdownOutputFile
2024-12-13 17:33:46 +00:00
echo " " >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:33:46 +00:00
echo "## Career Highlights" >> "$JobBoardMarkdownOutputFile"
echo "## Career Highlights" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:33:46 +00:00
cat $PipelineClientWorkingDir/Templates/SkillsAndProjects/Projects.md >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo "\pagebreak" >> $JobBoardMarkdownOutputFile
2024-12-13 17:33:46 +00:00
cat $PipelineClientWorkingDir/Templates/SkillsAndProjects/Projects.md >> "$ClientSubmissionMarkdownOutputFile"
echo "\pagebreak" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:33:46 +00:00
echo " " >> "$JobBoardMarkdownOutputFile"
echo "## Employment History" >> "$JobBoardMarkdownOutputFile"
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:33:46 +00:00
echo " " >> "$ClientSubmissionMarkdownOutputFile"
echo "## Employment History" >> "$ClientSubmissionMarkdownOutputFile"
echo " " >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
#And here we do some magic...
#Pull in :
# employer
# title
# start/end dates of employment
# long form position summary data from each position
IFS=$'\n\t'
for position in \
2024-12-10 22:31:43 +00:00
$(cat $PipelineClientWorkingDir/Templates/WorkHistory/WorkHistory.csv); do
2024-12-09 20:29:19 +00:00
COMPANY="$(echo $position|awk -F ',' '{print $1}')"
TITLE="$(echo $position|awk -F ',' '{print $2}')"
DATEOFEMPLOY="$(echo $position|awk -F ',' '{print $3}')"
echo " " >> "$JobBoardMarkdownOutputFile"
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> $JobBoardMarkdownOutputFile
echo " " >> "$JobBoardMarkdownOutputFile"
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> $ClientSubmissionMarkdownOutputFile
echo " " >> "$ClientSubmissionMarkdownOutputFile"
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-10 22:44:30 +00:00
cat $PipelineClientWorkingDir/Templates/JobHistoryDetails/$COMPANY.md >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-10 22:31:43 +00:00
cat $PipelineClientWorkingDir/Templates/JobHistoryDetails/$COMPANY.md >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$ClientSubmissionMarkdownOutputFile"
done
#Pull in my skills and generate a beautiful table.
2024-12-13 17:33:46 +00:00
echo "\pagebreak" >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$JobBoardMarkdownOutputFile"
echo "## Skills" >> "$JobBoardMarkdownOutputFile"
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-13 17:33:46 +00:00
echo "\pagebreak" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$ClientSubmissionMarkdownOutputFile"
echo "## Skills" >> "$ClientSubmissionMarkdownOutputFile"
echo " " >> "$ClientSubmissionMarkdownOutputFile"
#Table heading
echo "|Skill|Experience|Skill Details|" >> $JobBoardMarkdownOutputFile
echo "|---|---|---|" >> $JobBoardMarkdownOutputFile
echo "|Skill|Experience|Skill Details|" >> $ClientSubmissionMarkdownOutputFile
echo "|---|---|---|" >> $ClientSubmissionMarkdownOutputFile
#Table rows
IFS=$'\n\t'
for skill in \
2024-12-10 22:31:43 +00:00
$(cat $PipelineClientWorkingDir/Templates/SkillsAndProjects/Skills.csv); do
2024-12-09 20:29:19 +00:00
SKILL_NAME="$(echo $skill|awk -F '|' '{print $1}')"
SKILL_YEARS="$(echo $skill|awk -F '|' '{print $2}')"
SKILL_DETAIL="$(echo $skill|awk -F '|' '{print $3}')"
2024-12-13 17:33:46 +00:00
echo "|**$SKILL_NAME**|$SKILL_YEARS|$SKILL_DETAIL|" >> "$JobBoardMarkdownOutputFile"
echo "|**$SKILL_NAME**|$SKILL_YEARS|$SKILL_DETAIL|" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
done
unset IFS
echo "Generating PDF output for job board version..."
pandoc \
"$JobBoardMarkdownOutputFile" \
--template eisvogel \
2024-12-10 22:31:43 +00:00
--metadata-file="$PipelineClientWorkingDir/build-temp/JobBoard.yml" \
2024-12-09 20:29:19 +00:00
--from markdown \
--to=pdf \
2024-12-13 17:33:46 +00:00
--output "$JobBoardPDFOutputFile"
2024-12-09 20:29:19 +00:00
echo "Generating MSWord output for job board version..."
pandoc \
"$JobBoardMarkdownOutputFile" \
2024-12-10 22:31:43 +00:00
--metadata-file="$PipelineClientWorkingDir/build-temp/JobBoard.yml" \
2024-12-09 20:29:19 +00:00
--from markdown \
--to=docx \
--reference-doc="$PipelineClientWorkingDir/build/resume-docx-reference.docx" \
2024-12-13 17:33:46 +00:00
--output "$JobBoardMSWordOutputFile"
2024-12-09 20:29:19 +00:00
echo "Generating PDF output for client submission version..."
pandoc \
"$ClientSubmissionMarkdownOutputFile" \
--template eisvogel \
2024-12-10 22:31:43 +00:00
--metadata-file="$PipelineClientWorkingDir/build-temp/ClientSubmission.yml" \
2024-12-09 20:29:19 +00:00
--from markdown \
--to=pdf \
2024-12-13 17:33:46 +00:00
--output "$ClientSubmissionPDFOutputFile"
2024-12-09 20:29:19 +00:00
echo "Generating MSWord output for client submission version..."
pandoc \
"$ClientSubmissionMarkdownOutputFile" \
2024-12-10 22:31:43 +00:00
--metadata-file="$PipelineClientWorkingDir/build-temp/ClientSubmission.yml" \
2024-12-09 20:29:19 +00:00
--from markdown \
--to=docx \
--reference-doc="$PipelineClientWorkingDir/build/resume-docx-reference.docx" \
2024-12-13 17:33:46 +00:00
--output "$ClientSubmissionMSWordOutputFile"