#!/bin/sh set -eu YEAR="${1}" MONTH="$(printf "%02d" "${2}")" TAG="${YEAR}-${MONTH}" URL="https://reproducible-builds.org/reports/${TAG}/" DATE="$(date --utc +'%Y-%m-%d %H:%M:%S')" if ! shift 2 then echo "${0}: usage: ${0} " >&2 exit 2 fi FILENAME="_reports/${TAG}.md" if grep -qs FIXME "${FILENAME}" then echo "${0}: ${FILENAME} contains FIXME statements; refusing to publish." >&2 exit 2 fi if grep -qs 'draft: true' "${FILENAME}" then sed -i -e "s@^draft: true@draft: false\ndate: ${DATE}@g" "${FILENAME}" fi git add "${FILENAME}" if git commit -m "published as ${URL}" then git log -1 git tag -d "${TAG}" 2>/dev/null || true git tag -s "${TAG}" -m "Publish report for ${TAG}" echo echo "Now verify the results and run:" echo echo " $ git push origin master && git push origin refs/tags/${TAG}" echo while true do printf "Do you want to run this now? [Y/n] " read X case "${X}" in Y|"") git push origin master && git push origin refs/tags/${TAG} break ;; N|n) break ;; esac done fi echo echo echo "After ensuring this has been published, Tweet this via:" echo echo "%tweet Here's happened in the @ReproBuilds effort in the past month ${URL}" echo printf "Waiting for page to be published " while : do sleep 1 printf "." if ! curl -qs "${URL}" 2>/dev/null | grep -qs "This is an unpublished draft report." then break fi done echo echo echo "${URL} has been published"