diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9cf1186 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +dist-newstyle +.shake diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..57b171a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM haskell + +RUN mkdir -p /github/workspace + +RUN cabal update + +COPY ./psb.cabal /mnt +WORKDIR /mnt +RUN cabal build --only-dependencies + +COPY . /mnt + +RUN cabal build + +WORKDIR /github/workspace + +ENTRYPOINT ["/mnt/dist-newstyle/build/x86_64-linux/ghc-9.4.8/psb-0.1.0.0/x/psb/build/psb/psb", "build", "-p2"] diff --git a/TODO b/TODO index bd7b44f..af313d6 100644 --- a/TODO +++ b/TODO @@ -2,10 +2,12 @@ github action for deploy to github pages minify js and css when copying over instead of just copying -add in sass preprocessing with the cli - make typst dependant on yaml? +add rst support so I'm not dependant on typst not breaking + +add a cli flag to send webmentions and track the ones sent/acked in some file, probably a simple csv with path and what got linked to (https://indieweb.org/Webmention) (https://indieweb.org/Webmention-developer) + make it so typst citation section has a header and/or is a div elem instead of a section element process source code blocks with tree sitter https://hackage.haskell.org/package/tree-sitter diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..01d3e33 --- /dev/null +++ b/action.yml @@ -0,0 +1,6 @@ +# https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions +name: 'psb' +description: 'Use PSB to build' +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/app/Main.hs b/app/Main.hs index 9ea1e8c..474e1db 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -69,7 +69,8 @@ assets = map (outputDir ) assetGlobs |%> \target -> do let src = FP.dropDirectory1 target Shake.copyFileChanged src target - Shake.putInfo $ "Copied " <> target <> " from " <> src + +-- Shake.putInfo $ "Copied " <> target <> " from " <> src -- handling typst only because pages should only be typst no reason for backwards compat on that pages :: Rules () @@ -88,7 +89,8 @@ pages = pageSection = T.pack $ fromJust $ Shake.stripExtension "html" target } applyTemplateAndWrite "default.html" page target - Shake.putInfo $ "Built " <> target <> " from " <> src + +-- Shake.putInfo $ "Built " <> target <> " from " <> src -- there's probably a better way of doing this that allows for the target's origin file extension to get passed in but for now we're doing brute force postsRule :: Rules () @@ -127,7 +129,8 @@ typstPost src = do pageSection = T.pack $ fromJust $ Shake.stripExtension "html" target } applyTemplateAndWrite "default.html" page target - Shake.putInfo $ "Built " <> target <> " from " <> src + +-- Shake.putInfo $ "Built " <> target <> " from " <> src markdownPost :: FP.FilePath -> Action () markdownPost src = do @@ -148,7 +151,8 @@ markdownPost src = do pageSection = T.pack $ fromJust $ Shake.stripExtension "html" target } applyTemplateAndWrite "default.html" page target - Shake.putInfo $ "Built " <> target <> " from " <> src + +-- Shake.putInfo $ "Built " <> target <> " from " <> src home :: Rules () home = @@ -168,7 +172,8 @@ home = pageSection = T.pack $ fromJust $ Shake.stripExtension "html" target } applyTemplateAndWrite "default.html" page target - Shake.putInfo $ "Built " <> target + +-- Shake.putInfo $ "Built " <> target data Rss = Rss { now :: T.Text, @@ -185,7 +190,7 @@ rss = time <- Utilities.now applyTemplateAndWrite "feed.xml" (Rss time posts) target - Shake.putInfo $ "Built " <> target +-- Shake.putInfo $ "Built " <> target readPost :: FilePath -> Action Post readPost postPath = do @@ -198,7 +203,7 @@ readTypstPost :: FilePath -> Action Post readTypstPost postPath = do html <- typstToHtml postPath post <- yamlToPost $ typstMetaPath postPath - Shake.putInfo $ "Read " <> postPath + -- Shake.putInfo $ "Read " <> postPath return $ post { postContent = Just html, @@ -208,7 +213,7 @@ readTypstPost postPath = do readMarkdownPost :: FilePath -> Action Post readMarkdownPost postPath = do (post, html) <- markdownToHtml postPath - Shake.putInfo $ "Read " <> postPath + -- Shake.putInfo $ "Read " <> postPath return $ post { postContent = Just html, diff --git a/app/Templates.hs b/app/Templates.hs index ffe26d9..0c254cb 100644 --- a/app/Templates.hs +++ b/app/Templates.hs @@ -41,7 +41,7 @@ readTemplate templatePath = do case eTemplate of Right template -> do Shake.need . Mus.getPartials . Mus.ast $ template - Shake.putInfo $ "Read " <> templatePath + --Shake.putInfo $ "Read " <> templatePath return template Left err -> fail $ show err diff --git a/psb.cabal b/psb.cabal index a087371..2a2192f 100644 --- a/psb.cabal +++ b/psb.cabal @@ -68,10 +68,12 @@ executable psb default-extensions: ApplicativeDo DataKinds NamedFieldPuns DerivingVia LambdaCase TypeApplications DeriveGeneric -- Other library packages from which modules are imported. - build-depends: base ^>=4.17.2.1, mustache ^>=2.4.2, pandoc ^>=3.2.1, shake ^>= 0.19.8, deriving-aeson ^>= 0.2.9, aeson, text, time, unordered-containers, yaml + build-depends: base >=4.17.2.1, mustache >=2.4.2, pandoc >=3.2.1, shake >= 0.19.8, deriving-aeson >= 0.2.9, aeson, text, time, unordered-containers, yaml -- Directories containing source files. hs-source-dirs: app -- Base language which the package is written in. default-language: Haskell2010 + + ghc-options: -threaded