xin/ci

35 lines
598 B
Plaintext
Raw Normal View History

2023-01-29 06:11:36 -07:00
#!/usr/bin/env sh
. ./common.sh
2023-01-29 06:54:06 -07:00
set -eu
2023-01-29 08:29:43 -07:00
NAME="CI"
SESS="-s ${NAME}"
2023-01-29 08:30:43 -07:00
if tmux ls | grep -q "^${NAME}:"; then
2023-01-29 08:29:43 -07:00
tmux -u2 at -t "${NAME}"
else
2023-01-29 08:30:07 -07:00
tmux -2 new-session -d ${SESS}
2023-01-29 08:29:43 -07:00
fi
tmux -2 attach-session -t "$NAME"
2023-01-29 06:11:36 -07:00
trap ci_error INT TERM
ci_branch=$(date +"%Y%m%dT%H%M%S%z")
can_sign=0
for i in $(ssh-add -L | awk '{print $NF}'); do
grep -q $i .allowed_signers && can_sign=1
done
if [ $can_sign != 1 ]; then
echo "Can't find signing key."
exit 1
fi
git checkout -b "${ci_branch}" || handle_co_fail
nix flake update --commit-lock-file || handle_update_fail
nix flake check || handle_check_fail