aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci/mail.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-10 12:15:49 -0300
committerEuAndreh <eu@euandre.org>2020-08-10 12:45:43 -0300
commit100ab568e3aeb512e86fd1155a73454d22e24895 (patch)
tree1d7ff9168b8cfc60e173f2a19f30938bc68d0f6e /scripts/ci/mail.sh
parentWIP: Move to Vultr and NixOS (diff)
downloadtoph-100ab568e3aeb512e86fd1155a73454d22e24895.tar.gz
toph-100ab568e3aeb512e86fd1155a73454d22e24895.tar.xz
Migration: Remove Ansible and Docker code, move only to NixOS
Diffstat (limited to 'scripts/ci/mail.sh')
-rwxr-xr-xscripts/ci/mail.sh51
1 files changed, 0 insertions, 51 deletions
diff --git a/scripts/ci/mail.sh b/scripts/ci/mail.sh
deleted file mode 100755
index 9caebd4..0000000
--- a/scripts/ci/mail.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env bash
-set -Eeuo pipefail
-cd "$(dirname "${BASH_SOURCE[0]}")"
-cd ../../
-
-EXIT_CODE="${1:-}"
-
-[[ -z "${EXIT_CODE}" ]] && {
- # shellcheck disable=SC2016
- echo 'Error: missing $EXIT positional argument.'
- exit 2
-}
-
-if [[ "${EXIT_CODE}" = 0 ]]; then
- SUBJECT_SUFFIX=' (successful build)'
-else
- SUBJECT_SUFFIX=' (FAILED BUILD)'
-fi
-
-SUBJECT="VPS CI run #${JOB_ID} logs${SUBJECT_SUFFIX}"
-ATTACHMENT_PATH='logs.txt'
-BODY=$(cat <<EOF
-CI run for commit ${VPS_COMMIT_SHA}.
-See run:
-https://builds.sr.ht/~euandreh/job/${JOB_ID}
-
-Logs are attached.
-
-EOF
-)
-
-tail -n +1 ./logs/*.txt > "${ATTACHMENT_PATH}"
-
-[[ "${USER}" = "build" ]] || {
- echo "Not running on CI."
- echo "Early exit on sending email logs."
- exit
-}
-
-gpg --always-trust \
- -r "${GPG_TO}" \
- -e "${ATTACHMENT_PATH}"
-
-curl "${MAILGUN_URL}" \
- -s \
- --user "${MAILGUN_USER}" \
- -F from="${MAILGUN_FROM}" \
- -F to="${MAILGUN_TO}" \
- -F subject="${SUBJECT}" \
- -F text="${BODY}" \
- -F attachment="@${ATTACHMENT_PATH}.gpg"