From 76b9938c6e02528373dfa2ec6053c8f78e57b35e Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Mon, 27 Feb 2023 07:14:00 -0700 Subject: [PATCH] ci: actually error when we have errors --- bin/ci | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/bin/ci b/bin/ci index 6b9d75f..371c21b 100755 --- a/bin/ci +++ b/bin/ci @@ -25,16 +25,34 @@ fi git pull || handle_pull_fail if [ "${1}" = "update" ]; then - git checkout -b "${ci_branch}" || handle_co_fail - nix flake update --commit-lock-file || handle_update_fail - nix flake check || handle_check_fail - git checkout main || handle_co_fail - git merge "${ci_branch}" || handle_merge_fail + if ! git checkout -b "${ci_branch}"; then + handle_co_fail + exit 1 + fi + if ! nix flake update --commit-lock-file; then + handle_update_fail + exit 1 + fi + if ! nix flake check; then + handle_check_fail + exit 1 + fi + if ! git checkout main; then + handle_co_fail + exit 1 + fi + if ! git merge "${ci_branch}"; then + handle_merge_fail + exit 1 + fi # Agent is configured to forget keys after X, if that happens we need to re-add before push agentHasKey "$(cat /run/secrets/ci_ed25519_pub | awk '{print $2}')" || ssh-add /run/secrets/ci_ed25519_key - git push || handle_push_fail + if ! git push; then + handle_push_fail + exit 1 + fi else nix flake check || handle_check_fail fi