diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /vendor/mdbook/ci/make-release.sh | |
parent | Initial commit. (diff) | |
download | rustc-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/make-release.sh')
-rwxr-xr-x | vendor/mdbook/ci/make-release.sh | 47 |
1 files changed, 47 insertions, 0 deletions
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 |