#!/usr/bin/env bash # SPDX-FileCopyrightText: 2024 Julien Moutinho (adh14) # SPDX-License-Identifier: AGPL-3.0-or-later # shellcheck disable=SC2046 # shellcheck disable=SC2086 # shellcheck disable=SC2317 # To push and send mails: # scripts/send.sh rfcs/p1 # To push without sending mails: # scripts/send.sh rfcs/p1 no_git_send_email=set git_push=--force 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" rfcTagRev=$(git rev-list "$rfcTag" -1) git push ${git_push-} "$git_push_remote" "$rfcTagRev:refs/heads/$rfcBranch" git push ${git_push-} "$git_push_remote" "$rfcTagRev:refs/heads/${rfcBranch}v$rfcRevAdvocacy" git push ${git_push-} "$git_push_remote" fi