Include version into bundle name
This commit is contained in:
parent
8cb9ff92df
commit
ed143d89d4
2 changed files with 11 additions and 4 deletions
9
Makefile
9
Makefile
|
@ -4,6 +4,7 @@ NPM ?= $(shell command -v npm 2> /dev/null)
|
||||||
HTTP ?= $(shell command -v http 2> /dev/null)
|
HTTP ?= $(shell command -v http 2> /dev/null)
|
||||||
CURL ?= $(shell command -v curl 2> /dev/null)
|
CURL ?= $(shell command -v curl 2> /dev/null)
|
||||||
MANIFEST_FILE ?= plugin.json
|
MANIFEST_FILE ?= plugin.json
|
||||||
|
BUNDLE_NAME = $(PLUGIN_ID)_$(PLUGIN_VERSION).tar.gz
|
||||||
|
|
||||||
# Verify environment, and define PLUGIN_ID, HAS_SERVER and HAS_WEBAPP as needed.
|
# Verify environment, and define PLUGIN_ID, HAS_SERVER and HAS_WEBAPP as needed.
|
||||||
include build/setup.mk
|
include build/setup.mk
|
||||||
|
@ -61,9 +62,9 @@ ifneq ($(HAS_WEBAPP),)
|
||||||
mkdir -p dist/$(PLUGIN_ID)/webapp/dist;
|
mkdir -p dist/$(PLUGIN_ID)/webapp/dist;
|
||||||
cp -r webapp/dist/* dist/$(PLUGIN_ID)/webapp/dist/;
|
cp -r webapp/dist/* dist/$(PLUGIN_ID)/webapp/dist/;
|
||||||
endif
|
endif
|
||||||
cd dist && tar -cvzf $(PLUGIN_ID).tar.gz $(PLUGIN_ID)
|
cd dist && tar -cvzf $(BUNDLE_NAME) $(PLUGIN_ID)
|
||||||
|
|
||||||
@echo plugin built at: dist/$(PLUGIN_ID).tar.gz
|
@echo plugin built at: dist/$(BUNDLE_NAME)
|
||||||
|
|
||||||
# dist builds and bundles the plugin
|
# dist builds and bundles the plugin
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
|
@ -81,7 +82,7 @@ ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSW
|
||||||
(TOKEN=`http --print h POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login login_id=$(MM_ADMIN_USERNAME) password=$(MM_ADMIN_PASSWORD) | grep Token | cut -f2 -d' '` && \
|
(TOKEN=`http --print h POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login login_id=$(MM_ADMIN_USERNAME) password=$(MM_ADMIN_PASSWORD) | grep Token | cut -f2 -d' '` && \
|
||||||
http --print b GET $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/me Authorization:"Bearer $$TOKEN" && \
|
http --print b GET $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/me Authorization:"Bearer $$TOKEN" && \
|
||||||
http --print b DELETE $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID) Authorization:"Bearer $$TOKEN" && \
|
http --print b DELETE $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID) Authorization:"Bearer $$TOKEN" && \
|
||||||
http --print b --check-status --form POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins plugin@dist/$(PLUGIN_ID).tar.gz Authorization:"Bearer $$TOKEN" && \
|
http --print b --check-status --form POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins plugin@dist/$(BUNDLE_NAME) Authorization:"Bearer $$TOKEN" && \
|
||||||
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable Authorization:"Bearer $$TOKEN" && \
|
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable Authorization:"Bearer $$TOKEN" && \
|
||||||
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/logout Authorization:"Bearer $$TOKEN" \
|
http --print b POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/logout Authorization:"Bearer $$TOKEN" \
|
||||||
)
|
)
|
||||||
|
@ -89,7 +90,7 @@ else ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_
|
||||||
@echo "Installing plugin via API"
|
@echo "Installing plugin via API"
|
||||||
$(eval TOKEN := $(shell curl -i -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login -d '{"login_id": "$(MM_ADMIN_USERNAME)", "password": "$(MM_ADMIN_PASSWORD)"}' | grep Token | cut -f2 -d' ' 2> /dev/null))
|
$(eval TOKEN := $(shell curl -i -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login -d '{"login_id": "$(MM_ADMIN_USERNAME)", "password": "$(MM_ADMIN_PASSWORD)"}' | grep Token | cut -f2 -d' ' 2> /dev/null))
|
||||||
@curl -s -H "Authorization: Bearer $(TOKEN)" -X DELETE $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID) > /dev/null
|
@curl -s -H "Authorization: Bearer $(TOKEN)" -X DELETE $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID) > /dev/null
|
||||||
@curl -s -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins -F "plugin=@dist/$(PLUGIN_ID).tar.gz" > /dev/null && \
|
@curl -s -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins -F "plugin=@dist/$(BUNDLE_NAME)" > /dev/null && \
|
||||||
curl -s -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable > /dev/null && \
|
curl -s -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable > /dev/null && \
|
||||||
echo "OK." || echo "Sorry, something went wrong."
|
echo "OK." || echo "Sorry, something went wrong."
|
||||||
else ifneq ($(wildcard ../mattermost-server/.*),)
|
else ifneq ($(wildcard ../mattermost-server/.*),)
|
||||||
|
|
|
@ -13,6 +13,12 @@ ifeq ($(PLUGIN_ID),)
|
||||||
$(error "Cannot parse id from $(MANIFEST_FILE)")
|
$(error "Cannot parse id from $(MANIFEST_FILE)")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Extract the plugin version from the manifest.
|
||||||
|
PLUGIN_VERSION ?= $(shell build/bin/manifest version)
|
||||||
|
ifeq ($(PLUGIN_VERSION),)
|
||||||
|
$(error "Cannot parse id from $(MANIFEST_FILE)")
|
||||||
|
endif
|
||||||
|
|
||||||
# Determine if a server is defined in the manifest.
|
# Determine if a server is defined in the manifest.
|
||||||
HAS_SERVER ?= $(shell build/bin/manifest has_server)
|
HAS_SERVER ?= $(shell build/bin/manifest has_server)
|
||||||
|
|
||||||
|
|
Reference in a new issue