Blob Blame History Raw
#!/bin/bash
set -euxo pipefail

export VERSION=20.0.0
export PACKAGE_NAME=azure-mgmt-network
WORKING_DIR=$(pwd)

# Download the release and unpack it.
curl -LO https://github.com/Azure/azure-sdk-for-python/archive/refs/tags/${PACKAGE_NAME}_${VERSION}.tar.gz
tar xzf ${PACKAGE_NAME}_${VERSION}.tar.gz

# Find the package directory in the SDK release and the parent directory.
PACKAGE_DIR=$(find azure-sdk-for-python-${PACKAGE_NAME}_${VERSION} -type d -name $PACKAGE_NAME)
PARENT_DIR=$(dirname $PACKAGE_DIR)

# Build a tarball with a prefix directory that contains the package name and
# version. Store that in the directory where the script is running.
pushd $PARENT_DIR
    tar --transform "s/^${PACKAGE_NAME}/${PACKAGE_NAME}-${VERSION}/" -cz \
        -f ${WORKING_DIR}/${PACKAGE_NAME}-${VERSION}.tgz $PACKAGE_NAME
popd