ci: actually error when we have errors

This commit is contained in:
Aaron Bieber 2023-02-27 07:14:00 -07:00
parent 8bd9ead486
commit 76b9938c6e
No known key found for this signature in database

30
bin/ci
View File

@ -25,16 +25,34 @@ fi
git pull || handle_pull_fail git pull || handle_pull_fail
if [ "${1}" = "update" ]; then if [ "${1}" = "update" ]; then
git checkout -b "${ci_branch}" || handle_co_fail if ! git checkout -b "${ci_branch}"; then
nix flake update --commit-lock-file || handle_update_fail handle_co_fail
nix flake check || handle_check_fail exit 1
git checkout main || handle_co_fail fi
git merge "${ci_branch}" || handle_merge_fail 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 # 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}')" || agentHasKey "$(cat /run/secrets/ci_ed25519_pub | awk '{print $2}')" ||
ssh-add /run/secrets/ci_ed25519_key ssh-add /run/secrets/ci_ed25519_key
git push || handle_push_fail if ! git push; then
handle_push_fail
exit 1
fi
else else
nix flake check || handle_check_fail nix flake check || handle_check_fail
fi fi