github.com/waldiirawan/apm-agent-go/v2@v2.2.2/scripts/jenkins/package.sh (about) 1 #!/usr/bin/env bash 2 3 # Bash strict mode 4 set -eo pipefail 5 trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR 6 7 # Found current script directory 8 readonly RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 9 10 # Found project directory 11 readonly BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))" 12 13 # Extract application version 14 APP_VERSION="$(sed -n 's/AgentVersion = \"\(.*\)\"/\1/p' version.go | sed -e 's/^[[:space:]]*//')" 15 16 # Create a dist folder 17 rm -rf "${BASE_PROJECT}/dist" 18 mkdir -p "${BASE_PROJECT}/dist" 19 20 # Create tarball 21 cd "${BASE_PROJECT}" 22 tar -czf "./dist/workspace-${APP_VERSION}.tar.gz" --exclude="workspace-${APP_VERSION}.tar.gz" -C ./ .