Debian Codegraph @

contrib/release_www.sh

raw symbols SCIP
1 #!/bin/bash
2 #
3 # env vars:
4 # - WWW_DIR: path to "electrum-web" git clone
5 # - for signing the version announcement file:
6 # - ELECTRUM_SIGNING_ADDRESS (required)
7 # - ELECTRUM_SIGNING_WALLET (required)
8 #
9
10 set -e
11
12 PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/.."
13 CONTRIB="$PROJECT_ROOT/contrib"
14
15 cd "$PROJECT_ROOT"
16
17 . "$CONTRIB"/build_tools_util.sh
18
19
20 echo -n "Remember to run add_cosigner to add any additional sigs. Continue (y/n)? "
21 read answer
22 if [ "$answer" != "y" ]; then
23 echo "exit"
24 exit 1
25 fi
26
27
28 if [ -z "$WWW_DIR" ] ; then
29 WWW_DIR=/opt/electrum-web
30 fi
31
32 if [ -z "$ELECTRUM_SIGNING_WALLET" ] || [ -z "$ELECTRUM_SIGNING_ADDRESS" ]; then
33 echo "You need to set env vars ELECTRUM_SIGNING_WALLET and ELECTRUM_SIGNING_ADDRESS!"
34 exit 1
35 fi
36
37 VERSION=$("$CONTRIB"/print_electrum_version.py)
38 info "VERSION: $VERSION"
39
40 ANDROID_VERSIONCODE_NULLARCH=$("$CONTRIB"/android/get_apk_versioncode.py "null")
41 # ^ note: should parse as an integer in the final json
42 info "ANDROID_VERSIONCODE_NULLARCH: $ANDROID_VERSIONCODE_NULLARCH"
43
44 set -x
45
46 info "updating www repo"
47 ./contrib/make_download "$WWW_DIR"
48 info "signing the version announcement file"
49 sig=$(./run_electrum -o signmessage "$ELECTRUM_SIGNING_ADDRESS" "$VERSION" -w "$ELECTRUM_SIGNING_WALLET")
50 # note: the contents of "extradata" are currently not signed. We could add another field, extradata_sigs,
51 # containing signature(s) for "extradata". extradata, being json, would have to be canonically
52 # serialized before signing.
53 cat <<EOF > "$WWW_DIR"/version
54 {
55 "version": "$VERSION",
56 "signatures": {"$ELECTRUM_SIGNING_ADDRESS": "$sig"},
57 "extradata": {
58 "android_versioncode_nullarch": $ANDROID_VERSIONCODE_NULLARCH
59 }
60 }
61 EOF
62
63 # push changes to website repo
64 pushd "$WWW_DIR"
65 git diff
66 git commit -a -m "version $VERSION"
67 git push
68 popd
69
70
71 info "release_www.sh finished successfully."
72 info "now you should run WWW_DIR/publish.sh to sign the website commit and upload signature"