Make it easier to reason about state transitions
[tails.git] / bin / prepare-included-website-for-release
blob08535ea7000e90dc813e6d1262e4bea86785225e
1 #!/bin/bash
3 set -eu
4 set -x
6 # For git_current_branch
7 . "$(dirname "$0")"/../auto/scripts/utils.sh
9 ### Sanity checks
11 [ "$(git_current_branch)" = "${RELEASE_BRANCH:?}" ] \
12 || error "Not on branch '$RELEASE_BRANCH'"
14 ### Merge `master` into the branch used for the release
16 git fetch origin && git merge origin/master
18 if [ "$DIST" = stable ]; then # preparing a final release
19 echo "${VERSION:?}" > wiki/src/inc/stable_amd64_version.html
20 echo -n "${RELEASE_DATE:?}" > wiki/src/inc/stable_amd64_date.html
21 for type in img iso ; do
22 basename="tails-amd64-${VERSION:?}"
23 filename="${basename:?}.${type:?}"
24 echo "TZ=UTC gpg --no-options --keyid-format long --verify ${filename:?}.sig ${filename:?}" \
25 > wiki/src/inc/stable_amd64_${type:?}_gpg_verify.html
26 echo "https://download.tails.net/tails/stable/${basename:?}/${filename:?}" \
27 > wiki/src/inc/stable_amd64_${type:?}_url.html
28 echo "https://mirrors.wikimedia.org/tails/stable/${basename:?}/${filename:?}" \
29 > wiki/src/inc/stable_amd64_${type:?}_url_https.html
30 echo "https://tails.boum.org/torrents/files/${filename:?}.sig" \
31 > wiki/src/inc/stable_amd64_${type:?}_sig_url.html
32 echo "https://tails.boum.org/torrents/files/${filename:?}.torrent" \
33 > wiki/src/inc/stable_amd64_${type:?}_torrent_url.html
34 done
35 git commit wiki/src/inc/ -m "Update version and date for ${VERSION:?}."
38 ### Signing key downloaded by the Upgrader
40 TMP_GNUPG_HOME=$(mktemp -d)
41 gpg --homedir "${TMP_GNUPG_HOME:?}" --import wiki/src/tails-signing.key
42 gpg --homedir "${TMP_GNUPG_HOME:?}" \
43 --export-filter drop-subkey="revoked == 1" \
44 --export-options export-minimal \
45 --armor --export "${TAILS_SIGNATURE_KEY:?}" \
46 > wiki/src/tails-signing-minimal.key
47 git commit wiki/src/tails-signing-minimal.key \
48 -m "Update signing key used by the Upgrader" || :
49 rm -rf "${TMP_GNUPG_HOME:?}"
51 ### Translations
53 ./build-website --rebuild
54 git add wiki/src
55 git commit -m 'Update website PO files.'
57 ### Push
59 git push origin "${RELEASE_BRANCH:?}:${RELEASE_BRANCH:?}"