~kaction/nixfmt

ccfd9dab35faa61d714f515e017e43fbbff5d7ea — Zhenya Vinogradov 4 years ago 2877200 + 85cd6d7
Merge pull request #64 from serokell/zhenya/ops934-deploy-to-aws

[OPS-934] Deploy website to AWS, add 404 page
3 files changed, 20 insertions(+), 2 deletions(-)

M .buildkite/pipeline.yml
M default.nix
A js/404.html
M .buildkite/pipeline.yml => .buildkite/pipeline.yml +9 -1
@@ 3,6 3,10 @@
#
# SPDX-License-Identifier: MPL-2.0

env:
  CDN_DISTRIBUTION_ID: E13UN1J1JFIWUZ
  CDN_BUCKET: s3://nixfmt.serokell.io

steps:
  - label: nix-build
    commands:


@@ 15,4 19,8 @@ steps:
  - label: deploy web demo
    branches: master
    commands:
      - nix-build -A nixfmt-webdemo --out-link /var/lib/buildkite-agent-public/cd/nixfmt-web
      - nix-build -A nixfmt-webdemo
      - nix run -f . awscli -c
          aws s3 sync --delete result/ "$CDN_BUCKET"
      - nix run -f . awscli -c
          aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths '/*'

M default.nix => default.nix +4 -1
@@ 45,7 45,8 @@ in rec {
  nixfmt-js = ghcjsPackages.callCabal2nix "nixfmt" src { };
  nixfmt-webdemo = pkgs.runCommandNoCC "nixfmt-webdemo" { } ''
    mkdir $out
    cp ${./js/index.html} $_/index.html
    cp ${./js/index.html} $out/index.html
    cp ${./js/404.html} $out/404.html
    cp ${nixfmt-js}/bin/js-interface.jsexe/{rts,lib,out,runmain}.js $out
    substituteInPlace $out/index.html --replace ../dist/build/js-interface/js-interface.jsexe/ ./
  '';


@@ 56,4 57,6 @@ in rec {
      stylish-haskell
    ]);
  });

  inherit (pkgs) awscli;
}

A js/404.html => js/404.html +7 -0
@@ 0,0 1,7 @@
<!--
© 2020 Serokell <hi@serokell.io>

SPDX-License-Identifier: MPL-2.0
-->

404 Page Not Found