first attempts at GitLab pages

This commit is contained in:
Gregor Kleen 2023-05-11 10:07:30 +02:00
parent faec92ae37
commit 445140da96
4 changed files with 39 additions and 2 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@
.stack-work
_cache
_site
public
**/#*#
**/.#*

29
.gitlab-ci.yml Normal file
View File

@ -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"

1
_redirects Normal file
View File

@ -0,0 +1 @@
/ /index.html 200

View File

@ -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"