stack exec deploy
Last active
October 31, 2019 02:48
-
-
Save ethagnawl/0ada86cb6eb996d95d5b65bff014188c to your computer and use it in GitHub Desktop.
Deploying a Hakyll site with Haskell/Shelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ExtendedDefaultRules #-} | |
{-# OPTIONS_GHC -fno-warn-type-defaults #-} | |
import Shelly | |
import Data.Text as T | |
default (T.Text) | |
main = shelly $ verbosely $ do | |
_ <- escaping False $ cmd "test" "-z" "\"$(git status --porcelain)\"" | |
status <- lastExitCode | |
if status == 1 then | |
do | |
errorExit "You have uncommitted changes." | |
else | |
do | |
run "stack" ["clean"] | |
run "stack" ["setup"] | |
run "stack" ["build"] | |
run "git" ["checkout", "master"] | |
run "cp" ["-a", "_site/.", "."] | |
run "git" ["add", "-A"] | |
run "git" ["commit", "-m", "Publish to GitHub Pages"] | |
run "git" ["push", "origin", "master"] | |
run "git" ["checkout", "develop"] | |
echo "Finished publishing to GitHub Pages." | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: site | |
version: 0.1.0.0 | |
build-type: Simple | |
cabal-version: >= 1.10 | |
executable site | |
main-is: site.hs | |
build-depends: base == 4.* | |
, hakyll == 4.8.* | |
, hakyll-sass == 0.2.0 | |
ghc-options: -threaded | |
default-language: Haskell2010 | |
executable deploy | |
main-is: deploy.hs | |
build-depends: base == 4.* | |
, shelly == 1.7.* | |
ghc-options: -threaded | |
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolver: lts-10.3 | |
packages: | |
- . | |
extra-deps: [ | |
hakyll-sass-0.2.0, | |
shelly-1.7.0 | |
] | |
allow-newer: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment