From eba85c3ede72326f1343db3e2ac40a66761131ae Mon Sep 17 00:00:00 2001 From: James Munns Date: Tue, 27 Aug 2019 15:33:46 +0200 Subject: [PATCH] Fix regex, also install cargo-update with trust --- .travis.yml | 2 +- ci/install-cargo-update.sh | 19 +++++++++++++++++++ ci/install-mdbook.sh | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 ci/install-cargo-update.sh diff --git a/.travis.yml b/.travis.yml index 4e68a8b..01a364e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: before_script: - rustup component add rustfmt - - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) + - (test -x $HOME/.cargo/bin/cargo-install-update || ./ci/install-cargo-update.sh) - (test -x $HOME/.cargo/bin/mdbook || ./ci/install-mdbook.sh) - cargo install-update -a diff --git a/ci/install-cargo-update.sh b/ci/install-cargo-update.sh new file mode 100755 index 0000000..0755adc --- /dev/null +++ b/ci/install-cargo-update.sh @@ -0,0 +1,19 @@ +set -euxo pipefail + +# Based on the Rust-Embedded WG's book CI +# https://github.com/rust-embedded/book/blob/master/ci/install.sh + +main() { + # Note - this will accept any tagged release + local tag=$(git ls-remote --tags --refs --exit-code \ + https://github.com/nabijaczleweli/cargo-update \ + | cut -d/ -f3 \ + | grep -E '^v[0-9\.]+$' \ + | sort --version-sort \ + | tail -n1) + + curl -LSfs https://japaric.github.io/trust/install.sh | \ + sh -s -- --git nabijaczleweli/cargo-update --tag $tag +} + +main diff --git a/ci/install-mdbook.sh b/ci/install-mdbook.sh index 112fc02..01c87f8 100755 --- a/ci/install-mdbook.sh +++ b/ci/install-mdbook.sh @@ -8,7 +8,7 @@ main() { local tag=$(git ls-remote --tags --refs --exit-code \ https://github.com/rust-lang-nursery/mdbook \ | cut -d/ -f3 \ - | grep -E '^v0.3.[0-9]+$' \ + | grep -E '^v0\.3\.[0-9]+$' \ | sort --version-sort \ | tail -n1)