#!/bin/bash CONFIG_FILE="/home/users/tracer/gitea-runner-deb-builder/build.conf" source "$CONFIG_FILE" OUTPUT=$(/bin/bash /home/users/tracer/gitea-runner-deb-builder/build.sh 2>&1) EXIT_CODE=$? if [[ "$notify" == "never" ]]; then exit $EXIT_CODE fi if [[ "$notify" == "error" && $EXIT_CODE -ne 0 ]]; then SUBJECT="[Gitea Runner Build] Failed" echo "$OUTPUT" | mail -s "$SUBJECT" "$email" exit $EXIT_CODE fi if echo "$OUTPUT" | grep -q '^SKIP:'; then if [[ "$notify" == "error" || "$notify" == "success" ]]; then exit 0 fi fi if [[ "$notify" == "success" && $EXIT_CODE -eq 0 ]]; then SUBJECT="[Gitea Runner Build] Success" echo "$OUTPUT" | mail -s "$SUBJECT" "$email" exit 0 fi SUBJECT="[Gitea Runner Build] Run result: $( [[ $EXIT_CODE -eq 0 ]] && echo Success || echo Failure )" echo "$OUTPUT" | mail -s "$SUBJECT" "$email" exit $EXIT_CODE