-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·36 lines (27 loc) · 1.07 KB
/
init.sh
File metadata and controls
executable file
·36 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e
# install dependencies + compile proto files in sub package
cd package/googleads-nodejs
npm install
# get current version from Makefile and remove any old version folders
CURRENT_VERSION=$(awk -F'=' '/^GOOGLE_ADS_VERSION=/ {print $2}' ../../Makefile | tr -d '[:space:]')
if [ -z "$CURRENT_VERSION" ]; then
echo "Error: Could not determine current version from Makefile." >&2
exit 1
fi
CURRENT_VERSION_NUM=$(echo "$CURRENT_VERSION" | tr -d 'v')
PREVIOUS_VERSION_NUM=$((CURRENT_VERSION_NUM - 1))
PREVIOUS_VERSION="v${PREVIOUS_VERSION_NUM}"
echo "Searching for old version directories to remove ($PREVIOUS_VERSION)..."
DIRECTORIES_TO_DELETE=$(find . -type d -name "${PREVIOUS_VERSION}")
if [ -z "$DIRECTORIES_TO_DELETE" ]; then
echo "No old version directories found."
else
echo "Found and deleting the following directories:"
echo "$DIRECTORIES_TO_DELETE"
echo "$DIRECTORIES_TO_DELETE" | xargs rm -rf
fi
# remove large auto-generated tests we don't need
rm -rf build/test build/system-test
# copy the build up to the main package directory
cp -r build ../../