Skip to content

Commit

Permalink
[aptos-cli] Add build script for CLI release and bump CLI version
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario authored and aptos-bot committed May 13, 2022
1 parent 1aad128 commit 748b823
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/aptos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aptos"
version = "0.1.0"
version = "0.1.1"
authors = ["Aptos Labs <[email protected]>"]
description = "Aptos tool for management of nodes and interacting with the blockchain"
repository = "https://github.com/aptos-labs/aptos-core"
Expand Down
46 changes: 46 additions & 0 deletions scripts/cli/build_cli_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Copyright (c) Aptos
# SPDX-License-Identifier: Apache-2.0

###########################################
# Build and package a release for the CLI #
# #
###########################################

# Note: This must be run from the root of the aptos-core repository
NAME='aptos-cli'
CRATE_NAME='aptos'
CARGO_PATH="crates/$CRATE_NAME/Cargo.toml"

# Grab system information
ARCH=`uname -m`
OS=`uname -s`
VERSION=`cat "$CARGO_PATH" | grep "^\w*version =" | sed 's/^.*=[ ]*"//g' | sed 's/".*$//g'`

if [ "$OS" == "Darwin" ]; then
# Rename Darwin to MacOSX so it's less confusing
OS="MacOSX"
elif [ "$OS" == "Linux" ]; then
# Get linux flavor
OS=`cat /etc/os-release | grep '^NAME=' | sed 's/^.*=//g' | sed 's/"//g'`
fi

echo "Building release $VERSION of $NAME for $OS-$ARCH"
cargo build -p $CRATE_NAME --release

EXIT_CODE=$?
if [ "$EXIT_CODE" != "0" ]; then
echo "Build failed with exit code $EXIT_CODE"
exit $EXIT_CODE
fi

cd target/release/

# Compress the CLI
ZIP_NAME="$NAME-$VERSION-$OS-$ARCH.zip"

echo "Zipping release: $ZIP_NAME"
zip $ZIP_NAME $CRATE_NAME
mv $ZIP_NAME ../..

# TODO: Add installation instructions?

0 comments on commit 748b823

Please sign in to comment.