2020-07-09 14:50:47 +00:00
|
|
|
#!/bin/bash
|
2020-07-10 11:14:45 +00:00
|
|
|
#############################################################################
|
|
|
|
# NOTE: Update .template if logical changes are made to the script #
|
|
|
|
#############################################################################
|
2020-07-09 14:50:47 +00:00
|
|
|
|
2020-07-10 11:14:45 +00:00
|
|
|
# Alter these variables
|
|
|
|
#USERNAME= vps_sign_in(probably name@lexonomy.cjvt.si
|
2020-07-09 14:50:47 +00:00
|
|
|
#VPS_PASSWORD= vps password
|
2020-07-10 11:14:45 +00:00
|
|
|
#VPS_USERNAME= user name inside vps(probably name from @lexonomy)
|
2020-07-09 14:50:47 +00:00
|
|
|
#API_KEY= $(cat path/to/api/token/file)
|
|
|
|
|
2020-07-09 15:03:21 +00:00
|
|
|
# Exit if no argument is passed on run
|
2020-07-09 14:50:47 +00:00
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
echo "Must provide plugin name in environment" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
PLUGIN_NAME=$1
|
2020-07-09 15:03:21 +00:00
|
|
|
# Build the plugin
|
2020-07-09 14:50:47 +00:00
|
|
|
API_KEY=$API_KEY make
|
2020-07-09 15:03:21 +00:00
|
|
|
|
|
|
|
# zip all the required files and upload them to ssh
|
2020-07-09 14:59:14 +00:00
|
|
|
tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -"
|
2020-07-09 15:03:21 +00:00
|
|
|
|
|
|
|
# Create a simlink on VPS that will enable specific plugin on https://lexonomy.cjvt.si/
|
2020-07-10 11:14:45 +00:00
|
|
|
# Routes must be absolute or it doesn't work.
|
2020-07-09 14:50:47 +00:00
|
|
|
ssh -t $USERNAME -p $VPS_PASSWORD "sudo ln -s /home/$VPS_USERNAME/plugins/$PLUGIN_NAME /home/ozbolt/plugins/$PLUGIN_NAME"
|