diff --git a/.gitignore b/.gitignore index 10f2696..2e60796 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ .stack-work _cache -_site +public **/#*# **/.#* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1598b18 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +image: nixpkgs/nix-flakes + +workflow: + rules: + - if: $CI_COMMIT_BRANCH + +cache: + paths: + - .stack-work + - _cache + +pages: + stage: deploy + script: &build-script + - nix develop -c stack run site -- build + artifacts: + paths: + - public + rules: + - if: $CI_COMMIT_BRANCH == "main" + +test: + stage: test + script: *build-script + artifacts: + paths: + - public + rules: + - if: $CI_COMMIT_BRANCH != "main" diff --git a/_redirects b/_redirects new file mode 100644 index 0000000..5d87c4e --- /dev/null +++ b/_redirects @@ -0,0 +1 @@ +/ /index.html 200 diff --git a/src/Main.hs b/src/Main.hs index 099d88e..169d458 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -9,7 +9,10 @@ import Data.Maybe import System.FilePath config :: Configuration -config = defaultConfiguration +config = + defaultConfiguration + { destinationDirectory = "public" + } stripPathPrefix :: FilePath -> Routes stripPathPrefix (splitDirectories -> prefix) = @@ -18,6 +21,10 @@ stripPathPrefix (splitDirectories -> prefix) = main :: IO () main = hakyllWith config $ do + match "_redirects" $ do + route idRoute + compile copyFileCompiler + match "content/index.html" $ do route $ stripPathPrefix "content"