chiark / gitweb /
changelog: document further make-release changes
[otter.git] / make-release
index 1a274700fad57a3f239e4dbf4593df183b402e06..6b10ef80eb113bb91dba9534fbdcafb94169e6a9 100755 (executable)
@@ -5,9 +5,24 @@
 # eg
 #    ./make-release --dry-run main
 
+
+# Overall release steps:
+#
+#  - update dependencies (cargo update, cargo upgrades)
+#  - check `cargo audit`
+#  - edit CHANGELOG.md
+#  - update versions
+#  - ensure pretest == tested == main
+#  - make deploy and test that chiark still works
+#  - make-release --dry-run
+#  - make-release
+#  - release announcement to mailing list
+#  - blog post
+
 #---------- argument parsing and options ----------
 
 set -e
+set -o pipefail
 
 fail () { echo >&2 "${0##*/}: error: $*"; exit 12; }
 
@@ -22,6 +37,9 @@ esac
 
 keyid=0x559AE46C2D6B6D3265E7CBA1E3E3392348B50D39
 
+cratesio_raw_url=\
+https://raw.githubusercontent.com/rust-lang/crates.io-index/master
+
 branch="$2"
 
 dryrun () { echo "WOULD  $*"; }
@@ -65,7 +83,7 @@ if [ "x$tag_exists" != x ]; then trouble "tag $tag already exists"; fi
 head -1 CHANGELOG.md | grep "^Version $version" \
 || trouble "CHANGELOG.md not updated"
 
-cargo_order='base . cli daemon wasm apitest wdriver'
+cargo_order='base support . cli daemon wasm apitest wdriver jstest'
 missing=(git ls-files :\*/Cargo.toml :Cargo.toml)
 for x in $cargo_order; do missing+=(:!$x/Cargo.toml); done
 missing=$( "${missing[@]}" )
@@ -86,21 +104,47 @@ $dryrun git push origin $branch
 
 #---------- non-idempotent things ----------
 
-$dryrun make -j12 publish
+$dryrun make -j12 PUBLISH_VERSION=$version publish
+$dryrun make -j12 PUBLISH_VERSION=$version publish-make-current
 
 $dryrun git tag -s -u "$keyid" -m "Otter v$version" $tag
 $dryrun git push chiark $tag
 $dryrun git push origin $tag
 
+#---------- oh woe cargo ----------
+
+# https://github.com/rust-lang/cargo/issues/9507
+wait_for_crates_io () {
+    local p=$1
+    local delay=1
+    local url="$cratesio_raw_url/${p:0:2}/${p:2:2}/$p"
+    printf >&2 "waiting for upload of %s to take effect" "$p"
+    while sleep $delay; do
+       printf >&2 .
+       local got=$(
+           curl -sS "$url" | jq '.vers | select(. == "'"$version"'")'
+       )
+       if [ "x$got" != x ]; then break; fi
+       delay=$(( $delay * 11 / 10 + 1 ))
+    done
+    echo >&2 'done'
+}
 
 for cargo_dir in $cargo_order; do
     $dryrun_no_more_cargo \
-    nailing-cargo --no-nail --linkfarm=git --- \
+    nailing-cargo --no-nail --preclean-build=src --git --- \
         sh -xec "
-          find . ! -type l ! -type d ! -path './target/*' -print0 \
-              | xargs -0r rm --
+          unset http_proxy; unset https_proxy
           cd $cargo_dir; cargo publish $cargo_dryrun
         "
+
+    cargo_package=$(
+       sed -n '/^name *=/ { s/^name *= *"\(.*\)" *$/\1/; p; q }' \
+           <$cargo_dir/Cargo.toml
+    )
+
+    wait_for_crates_io "$cargo_package"
+
     dryrun_no_more_cargo=$dryrun
 
 done