-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.sh
executable file
·40 lines (30 loc) · 853 Bytes
/
package.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
#!/bin/sh
#Script for create the plugin artifact
if [ "$TAG" = "" ]
then
TAG='1.0.0'
fi
echo "tag: $TAG"
OUTPUT_DIR="output"
SDK_DIR="src/TransbankSDK"
CONFIG_PLUGIN_FILE="config.json"
OUTPUT_PLUGIN_DIR="Transbank"
PLUGIN_FILE="plugin-scart-webpay-rest-$TAG.zip"
# Install plugin dependencies
cd "$SDK_DIR" || exit
composer install --no-dev
composer update --no-dev
cd ../../
# Create content
mkdir -p "$OUTPUT_DIR/$OUTPUT_PLUGIN_DIR"
cp -r src/* "$OUTPUT_DIR/$OUTPUT_PLUGIN_DIR"
cd "$OUTPUT_DIR/$OUTPUT_PLUGIN_DIR" || exit
# Change version to config file
sed -i.bkp "s/\"1.0.0\"/\"${TAG#"v"}\"/g" "$CONFIG_PLUGIN_FILE"
cd ../
# Create zip
zip -FSr $PLUGIN_FILE $OUTPUT_PLUGIN_DIR -x "$OUTPUT_PLUGIN_DIR/$CONFIG_PLUGIN_FILE.bkp"
# Delete plugin content
rm -R "$OUTPUT_PLUGIN_DIR"
echo "Plugin version: $TAG"
echo "Plugin file: $PLUGIN_FILE"