forked from tapd8/apig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkg.sh
executable file
·61 lines (50 loc) · 1.17 KB
/
pkg.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
if [ "$BUILD_PLATFORM" == "arm64" ]; then
NDK_ARC=arm64
else
NDK_ARC=x64
fi
WORK_DIR="`pwd`"
APP_HOME="$(cd `dirname $0`; pwd)"
echo "cd $APP_HOME"
cd $APP_HOME
# VERSION=`grep "version" $APP_HOME/package.json | awk -F: '{ print $2 }' | awk -F \" '{ print $2 }'`
VERSION=`git describe --long HEAD`
TARGET_NAME=apig-$VERSION
TARGET_PATH="$APP_HOME/deploy/$TARGET_NAME"
if [ -d $TARGET_PATH ]; then
rm -rf $TARGET_PATH
fi
mkdir -p $TARGET_PATH
echo "Copying files..."
cp -r \
*.js \
*.json \
*.ts \
start.sh \
stop.sh \
generators \
node_modules \
public \
src \
$TARGET_PATH
echo ";config.version = '$VERSION';" >> "$TARGET_PATH/config.js"
#sed -i '$d' "$APP_HOME/config.js"
echo "Removing some files..."
rm -rf \
$TARGET_PATH/src/controllers/* \
$TARGET_PATH/src/datasources/* \
$TARGET_PATH/src/models/* \
$TARGET_PATH/src/repositories/*
echo "Packaging $TARGET_PATH"
cd deploy
tar -zcf "$TARGET_NAME-$NDK_ARC.tar.gz" $TARGET_NAME
cp howtoRunTpl.md $TARGET_NAME-$NDK_ARC"-HowtoRunReadme.md.txt"
echo "Cleaning..."
rm -rf $TARGET_PATH
echo "Look here: "
echo "ls -lh $TARGET_PATH*"
#du -h "$TARGET_PATH.tar.gz"
ls -lh $TARGET_PATH*
echo "Done!"
#cd $WORK_DIR