Created
February 1, 2020 04:01
-
-
Save icelander/a295e7e9e43516464d1ec6b80b86d547 to your computer and use it in GitHub Desktop.
A simple script to deploy a Mattermost plugin using mmctl after building it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### How to Use | |
# | |
# - Verify you have both jq and mmctl installed | |
# - Set up at least one set of authentication credentials in mmctl | |
# - Configure your Mattermost server to accept plugin file uploads | |
# - Place in the root directory of your Mattermost Plugin Project | |
# - Run `make` to create the plugin file in `dist/` | |
# - Run this script to deploy the plugin | |
# | |
# *NOTE* Double check your mmctl auth credentials!!! | |
jq_cmd=jq | |
[[ $(type -P "$jq_cmd") ]] || { | |
echo "'$jq_cmd' command line JSON processor not found"; | |
echo "Please install on linux with 'sudo apt-get install jq'" | |
echo "Please install on mac with 'brew install jq'" | |
exit 1; | |
} | |
mmctl_cmd=mmctl | |
[[ $(type -P "$mmctl_cmd") ]] || { | |
echo "'$mmctl_cmd' command line JSON processor not found"; | |
echo "Please install on linux with 'sudo apt-get install mmctl'" | |
echo "Please install on mac with 'brew install mmctl'" | |
exit 1; | |
} | |
id=`${jq_cmd} -r '.id' plugin.json` | |
name=`${jq_cmd} -r '.name' plugin.json` | |
version=`${jq_cmd} -r '.version' plugin.json` | |
archive_name="dist/${id}-${version}.tar.gz" | |
${mmctl_cmd} auth current | |
read -p "To deploy ${name} to the above server, press enter:" | |
# mmctl makes this *easy* | |
${mmctl_cmd} plugin disable $id | |
${mmctl_cmd} plugin delete $id | |
${mmctl_cmd} plugin add $archive_name | |
${mmctl_cmd} plugin enable $id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment