#!/usr/bin/env bash # Usage: scripts/send.sh rfcs/p1 # SPDX-FileCopyrightText: 2024 Julien Moutinho (adh14) # SPDX-License-Identifier: AGPL-3.0-or-later # shellcheck disable=SC2046 # shellcheck disable=SC2086 # shellcheck disable=SC2317 set -eux . "${0%/*}"/lib.sh rfcDir=$1; shift test $# -le 0 || declare "$@" coverLetter=$(mktemp) removeAtExit+=("$coverLetter") mimepart_alternative=$(uuidgen) mimepart_related=$(uuidgen) rfcDirMetadata rfcRevision rfcTag #rfcPDF -o "$rfcDir/${rfcRepo}-${rfcTag}".pdf git_push_remote=${git_push_remote-origin} if test ! "${no_git_send_email:+set}"; then { # coverLetter rfcPlain \ $(rfcMetadata) \ --template "${0%/*}"/../styles/rfc.header.mail \ -o - cat <"$coverLetter" patchesDir=$(mktemp -d) removeAtExit+=("$patchesDir") git format-patch "${git_push_remote}/${rfcBranch}..$rfcTag" \ --output-directory "$patchesDir" \ "$rfcDir" ':!*.html' rfcAdvocacyMeta=$(mktemp --suffix ".json") removeAtExit+=("$rfcAdvocacyMeta") pandoc -o "$rfcAdvocacyMeta" --to plain \ --template "$rfcRoot"/styles/metadata.json \ "$rfcDir"/advocacy.md git send-email ${git_send_email-} \ --to "$(jq -r .To <"$rfcAdvocacyMeta" | sed -e '/^null$/d')" \ --cc "$(jq -r .Cc <"$rfcAdvocacyMeta" | sed -e '/^null$/d')" \ --confirm cc \ --8bit-encoding UTF-8 \ --cover-letter "$coverLetter" \ "$patchesDir" fi if test ! "${no_git_push:+set}"; then git push ${git_push-} --follow-tags "$git_push_remote" "$rfcTag" git push ${git_push-} "$git_push_remote" "$(git rev-list "$rfcTag" -1):${rfcBranch}" git push ${git_push-} "$git_push_remote" fi