-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (51 loc) · 2.1 KB
/
Copy pathMakefile
File metadata and controls
61 lines (51 loc) · 2.1 KB
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
STATIC_DIR = src/plone/patternslib/static
# Prerequisites:
# - make
# - curl
# - git
# - jq
# Download a Patternslib universal bundle from GitHub releases and replace
# the existing one.
#
# You can use the `PATTERNSLIB_VERSION` environment variable to download a
# specific version, e.g. a pre-release version which would not be picked up
# automatically:
# `PATTERNSLIB_VERSION=9.7.0-alpha.5 make update-patterns`
#
.PHONY: update-patterns
update-patterns:
ifndef PATTERNSLIB_VERSION
@echo "🧪 Get the latest Patternslib version from GitHub (no pre-release)."
@# If no PATTERNSLIB_VERSION environment variable is defined,
@# Get the latest version from the GitHub API.
# Also see: https://stackoverflow.com/a/42040905/1337474
$(eval PATTERNSLIB_VERSION := $(shell curl https://api.github.com/repos/patternslib/Patterns/releases/latest -s | jq .tag_name -r))
@echo "🏷️ Patternslib version is: $(PATTERNSLIB_VERSION)"
endif
@echo "🧪 Copy bundle from GitHub."
@# Download the Patternslib bundle.
wget https://github.com/Patternslib/Patterns/releases/download/$(PATTERNSLIB_VERSION)/patternslib-bundle-$(PATTERNSLIB_VERSION).zip 1> /dev/null 2> /dev/null
@unzip patternslib-bundle-$(PATTERNSLIB_VERSION).zip > /dev/null
@# Replace the old Patternslib with the new one.
@rm -Rf $(STATIC_DIR)
@mv patternslib-bundle-$(PATTERNSLIB_VERSION) $(STATIC_DIR)
@# Cleanup.
@rm patternslib-bundle-$(PATTERNSLIB_VERSION).zip
@echo "🧪 Git add and commit."
@# Store Patternslib reference
@sed -i "s/version=[^,]*/version=\"$(PATTERNSLIB_VERSION).dev0\"/" setup.py
@git add $(STATIC_DIR) setup.py
@# Add changelog entry
@towncrier create +update-patternslib.feature \
--content "Update Patternslib to $(PATTERNSLIB_VERSION)."
@# Add with a `*` in case a number was appended due to a naming conflict.
@git add news/+update-patternslib.feature*
@# commit
@git commit -m"Update Patternslib to $(PATTERNSLIB_VERSION)." > /dev/null
@# Spit out info.
@echo ""
@echo "📦 Patternslib static folder size is: "
@cd $(STATIC_DIR) && du -sh
@echo ""
@echo "🚀 Updated Patternslib to $(PATTERNSLIB_VERSION)."
@echo ""