diff options
author | EuAndreh <eu@euandre.org> | 2020-11-29 01:18:47 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-11-29 01:30:36 -0300 |
commit | 2f13799914bb85e7537a5c23939291edd455c3c2 (patch) | |
tree | a63e366b3045c5bfba97636fcc59cf0d85f9da8d | |
parent | vps.scm: WIP setup cgit (diff) | |
download | toph-2f13799914bb85e7537a5c23939291edd455c3c2.tar.gz toph-2f13799914bb85e7537a5c23939291edd455c3c2.tar.xz |
Add scripts/ci-build.sh
-rwxr-xr-x | scripts/ci-build.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/ci-build.sh b/scripts/ci-build.sh new file mode 100755 index 0000000..67bb59d --- /dev/null +++ b/scripts/ci-build.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +set -x + +read -r _ SHA _ # oldrev newrev refname +LOGFILE="/data/static/ci-logs/vps/$(date -Is)-$SHA.log" +mkdir -p "$(dirname "$LOGFILE")" +exec &> >(tee -a "$LOGFILE") + +echo "Starting CI job at: $(date -Is)" + +finish() { + STATUS="$?" + printf "\n\n>>> exit status was %s\n" "$STATUS" + echo "Finishing CI job at: $(date -Is)" + popd + NOTE=$(cat <<EOF +See CI logs with: + git notes --ref=refs/notes/ci-logs show $SHA + git notes --ref=refs/notes/ci-data show $SHA +EOF +) + git notes --ref=refs/notes/ci-data add -f -m "$STATUS $LOGFILE" + git notes --ref=refs/notes/ci-logs add -f -F "$LOGFILE" + git notes add -f -m "$NOTE" + printf "\n\n>>> CI logs added as Git note." +} +trap finish EXIT + +unset GIT_DIR +CLONE="$(mktemp -d)" +git clone . "$CLONE" +pushd "$CLONE" +git config --global user.email git@euandre.org +git config --global user.name 'EuAndreh CI' + +./container make check site +./container make publish |