Add option to build for staging

This uses a different base url and adds uses an all-blocking robots.txt.
This commit is contained in:
Simon Bruder 2021-12-11 17:35:21 +01:00
parent 1294d2f305
commit 281157346e
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
3 changed files with 23 additions and 4 deletions

View file

@ -1,8 +1,22 @@
#!/bin/sh
#!/usr/bin/env bash
set -e
declare -a zola_options
SCHABERNACK_ENV=${SCHABERNACK_ENV:-production}
if [ "${SCHABERNACK_ENV}" = "staging" ]; then
echo "Building staging version" >&2
zola_options+=(-u https://staging.schulischer-schabernack.de)
fi
./metadata.py
zola build
zola build ${zola_options[@]}
echo "Encoding…"
./encode.py
./metadata.py
zola build
zola build ${zola_options[@]}
if [ "${SCHABERNACK_ENV}" = "staging" ]; then
cp static/robots.txt.staging public/robots.txt
fi

View file

@ -10,7 +10,7 @@
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
in
rec {
packages = {
packages = rec {
bulma = pkgs.fetchzip {
url = "https://github.com/jgthms/bulma/releases/download/0.9.0/bulma-0.9.0.zip";
sha256 = "sha256-FKWdkq6pRukCzR2IQ88OHlPkIJbeeEz7NdIWv44k8TM=";
@ -32,6 +32,7 @@
, ffmpeg-full
, python3
, zola
, staging ? false
}:
let
linkVendor = ''
@ -56,6 +57,8 @@
zola
];
SCHABERNACK_ENV = if staging then "staging" else "production";
postPatch = ''
patchShebangs .
'';
@ -85,6 +88,8 @@
'';
})
{ };
schulischer-schabernack-staging = schulischer-schabernack.override { staging = true; };
};
defaultPackage = packages.schulischer-schabernack;