summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/ci
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/mdbook/ci
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/mdbook/ci')
-rwxr-xr-xvendor/mdbook/ci/install-hub.sh24
-rwxr-xr-xvendor/mdbook/ci/install-rust.sh19
-rwxr-xr-xvendor/mdbook/ci/make-release.sh47
3 files changed, 90 insertions, 0 deletions
diff --git a/vendor/mdbook/ci/install-hub.sh b/vendor/mdbook/ci/install-hub.sh
new file mode 100755
index 000000000..38da2c8cb
--- /dev/null
+++ b/vendor/mdbook/ci/install-hub.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# Installs the `hub` executable into hub/bin
+set -ex
+case $1 in
+ ubuntu*)
+ curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-linux-amd64-2.12.8.tgz -o hub.tgz
+ mkdir hub
+ tar -xzvf hub.tgz --strip=1 -C hub
+ ;;
+ macos*)
+ curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-darwin-amd64-2.12.8.tgz -o hub.tgz
+ mkdir hub
+ tar -xzvf hub.tgz --strip=1 -C hub
+ ;;
+ windows*)
+ curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-windows-amd64-2.12.8.zip -o hub.zip
+ 7z x hub.zip -ohub
+ ;;
+ *)
+ echo "OS should be first parameter, was: $1"
+ ;;
+esac
+
+echo "$PWD/hub/bin" >> $GITHUB_PATH
diff --git a/vendor/mdbook/ci/install-rust.sh b/vendor/mdbook/ci/install-rust.sh
new file mode 100755
index 000000000..c608c70d0
--- /dev/null
+++ b/vendor/mdbook/ci/install-rust.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# Install/update rust.
+# The first argument should be the toolchain to install.
+
+set -ex
+if [ -z "$1" ]
+then
+ echo "First parameter must be toolchain to install."
+ exit 1
+fi
+TOOLCHAIN="$1"
+
+rustup set profile minimal
+rustup component remove --toolchain=$TOOLCHAIN rust-docs || echo "already removed"
+rustup update --no-self-update $TOOLCHAIN
+rustup default $TOOLCHAIN
+rustup -V
+rustc -Vv
+cargo -V
diff --git a/vendor/mdbook/ci/make-release.sh b/vendor/mdbook/ci/make-release.sh
new file mode 100755
index 000000000..761923bf9
--- /dev/null
+++ b/vendor/mdbook/ci/make-release.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# Builds the release and creates an archive and optionally deploys to GitHub.
+set -ex
+
+if [[ -z "$GITHUB_REF" ]]
+then
+ echo "GITHUB_REF must be set"
+ exit 1
+fi
+# Strip mdbook-refs/tags/ from the start of the ref.
+TAG=${GITHUB_REF#*/tags/}
+
+host=$(rustc -Vv | grep ^host: | sed -e "s/host: //g")
+export CARGO_PROFILE_RELEASE_LTO=true
+cargo build --bin mdbook --release
+cd target/release
+case $1 in
+ ubuntu*)
+ asset="mdbook-$TAG-$host.tar.gz"
+ tar czf ../../$asset mdbook
+ ;;
+ macos*)
+ asset="mdbook-$TAG-$host.tar.gz"
+ # There is a bug with BSD tar on macOS where the first 8MB of the file are
+ # sometimes all NUL bytes. See https://github.com/actions/cache/issues/403
+ # and https://github.com/rust-lang/cargo/issues/8603 for some more
+ # information. An alternative solution here is to install GNU tar, but
+ # flushing the disk cache seems to work, too.
+ sudo /usr/sbin/purge
+ tar czf ../../$asset mdbook
+ ;;
+ windows*)
+ asset="mdbook-$TAG-$host.zip"
+ 7z a ../../$asset mdbook.exe
+ ;;
+ *)
+ echo "OS should be first parameter, was: $1"
+ ;;
+esac
+cd ../..
+
+if [[ -z "$GITHUB_TOKEN" ]]
+then
+ echo "$GITHUB_TOKEN not set, skipping deploy."
+else
+ hub release edit -m "" --attach $asset $TAG
+fi