Skip to content

Commit

Permalink
move resume generation to ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
emekoi committed Oct 18, 2024
1 parent 4d9ade0 commit f8c58d3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,17 @@ jobs:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: build blog and resume
uses: xu-cheng/texlive-action@v2
- name: build blog
run: |
cabal build all
cabal exec -- blog build -v Info
- name: build resume
uses: xu-cheng/latex-action@v3
with:
scheme: small
run: |
cabal build all
cabal exec -- blog build -v Info
args: -r resume/latexmkrc -outdir=_site/static -auxdir=.shake/
root_file: resume/resume.tex


- name: setup pages
uses: actions/configure-pages@v4
Expand Down
30 changes: 17 additions & 13 deletions Blog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ data Options = Options
, jobs :: Int
}

newtype BuildOptions
= BuildOptions { watch :: Bool }
data BuildOptions = BuildOptions
{ watch :: Bool
, latex :: Bool
}

newtype CleanOptions
= CleanOptions { cache :: Bool }
Expand Down Expand Up @@ -230,16 +232,17 @@ build b = do
]

-- build resume
routeStatic "resume/resume.tex" "static/resume.pdf" \_ output -> do
putInfo $ unwords ["RESUME", output]

need ["resume/resume.sty", "resume/latexmkrc"]
buildDir <- shakeFiles <$> getShakeOptions
cmd_ @(String -> [String] -> _)
"latexmk -r resume/latexmkrc -quiet"
[ "-outdir=" ++ Shake.takeDirectory output
, "-auxdir=" ++ buildDir
]
when b.latex do
routeStatic "resume/resume.tex" "static/resume.pdf" \_ output -> do
putInfo $ unwords ["RESUME", output]

need ["resume/resume.sty", "resume/latexmkrc"]
buildDir <- shakeFiles <$> getShakeOptions
cmd_ @(String -> [String] -> _)
"latexmk -r resume/latexmkrc -quiet"
[ "-outdir=" ++ Shake.takeDirectory output
, "-auxdir=" ++ buildDir
]

-- write JSON feed
routeStatic1 "feed.json" \output -> do
Expand Down Expand Up @@ -529,7 +532,7 @@ parseOptions = do
[ A.command "build" (A.info pBuild (A.progDesc "Build the site"))
, A.command "clean" (A.info pClean (A.progDesc "Remove build files"))
, A.command "preview" (A.info pPreview (A.progDesc "Run a preview server"))
]) <|> pBuild
])

verbosity <- A.option A.auto (mconcat
[ A.long "verbosity"
Expand All @@ -549,6 +552,7 @@ parseOptions = do
where
pBuild = Build <$> do
watch <- A.switch (A.long "watch" <> A.short 'w' <> A.help "Watch for changes and rebuild automatically")
latex <- A.switch (A.long "latex" <> A.help "Build PDFs with latexmk")
pure BuildOptions {..}

pClean = Clean <$> do
Expand Down

0 comments on commit f8c58d3

Please sign in to comment.