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

156 lines
5.9 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
#####################################################################################################
#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-13 18:12:09 +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-13 18:12:09 +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 \
2024-12-13 17:53:17 +00:00
--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:53:17 +00:00
cat "$BUILD_TEMP_DIR/ContactInfo-JobBoard.md" >> "$JobBoardMarkdownOutputFile"
2024-12-13 17:33:46 +00:00
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:53:17 +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:53:17 +00:00
cat "$PipelineClientWorkingDir/Templates/SkillsAndProjects/Projects.md" >> "$JobBoardMarkdownOutputFile"
echo "\pagebreak" >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:53:17 +00:00
cat "$PipelineClientWorkingDir/Templates/SkillsAndProjects/Projects.md" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-13 17:33:46 +00:00
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-13 17:53:17 +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"
2024-12-13 17:53:17 +00:00
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-13 17:53:17 +00:00
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$ClientSubmissionMarkdownOutputFile"
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-13 17:53:17 +00:00
cat "$PipelineClientWorkingDir/Templates/JobHistoryDetails/$COMPANY.md" >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
echo " " >> "$JobBoardMarkdownOutputFile"
2024-12-13 17:53:17 +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
2024-12-13 17:53:17 +00:00
echo "|Skill|Experience|Skill Details|" >> "$JobBoardMarkdownOutputFile"
echo "|---|---|---|" >> "$JobBoardMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
2024-12-13 17:53:17 +00:00
echo "|Skill|Experience|Skill Details|" >> "$ClientSubmissionMarkdownOutputFile"
echo "|---|---|---|" >> "$ClientSubmissionMarkdownOutputFile"
2024-12-09 20:29:19 +00:00
#Table rows
IFS=$'\n\t'
for skill in \
2024-12-13 17:53:17 +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:53:17 +00:00
--output "$ClientSubmissionMSWordOutputFile"