From 28a643f91a387dd7871973e90c6f9909f0c79280 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Wed, 1 Nov 2023 19:57:19 +0100 Subject: [PATCH] chore: add aws doc update to tasks #126 --- devenv.nix | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/devenv.nix b/devenv.nix index 1c37efb06..2bb30bf96 100644 --- a/devenv.nix +++ b/devenv.nix @@ -18,6 +18,7 @@ in { (inputs.bob.defaultPackage."${currentSystem}") (inputs.version.defaultPackage."${currentSystem}") + awscli2 appimage-run blackbox coreutils-full @@ -259,6 +260,56 @@ ${pkgs.xdg-utils}/bin/xdg-open ''${TEST_PATH}web/test.html ''; + scripts.publish-doc.exec = '' +#!${pkgs.bash}/bin/bash + +if [ -t 1 ]; then + RED='\033[0;31m' + GREEN='\033[0;32m' + RESET='\033[0m' + BOLD='\033[1m' +else + RED="" + GREEN="" + RESET="" +fi + +profileExists=$(aws configure list-profiles | grep shopcloud | wc -l) +if [ "$profileExists" -eq "0" ]; then + echo "No shopcloud profile found. Exiting." + echo "Please run: aws configure --profile=shopcloud" + exit 1 +fi + +if [ -d ${config.devenv.root}/dist/doc ]; then + rm -rf ${config.devenv.root}/dist/doc +fi + +build-doc +code=$? +if [ "$code" -ne "0" ]; then + echo -e "''${RED}✖ Generate doc failed.''${RESET}" + exit 1 +fi +echo -e "''${GREEN}✔ Generate doc successful.''${RESET}" + +if [ ! -d ${config.devenv.root}/dist/doc ]; then + echo -e "''${RED}✖ No doc found.''${RESET}" + exit 1 +fi + + +${pkgs.awscli2}/bin/aws --profile=shopcloud s3 --recursive --only-show-errors cp ${config.devenv.root}/dist/doc/ s3://monsterjs.org/en/api/ +code=$? + +if [ "$code" -ne "0" ]; then + echo -e "''${RED}✖ Upload failed.''${RESET}" + exit 1 +fi +echo -e "''${GREEN}✔ Upload successful.''${RESET}" + + ''; + scripts.build-doc.exec = '' rm -rf ${config.devenv.root}/dist/doc -- GitLab