I’ve been using this approach for private theme updates using versioned archives and it seems to work for me pretty well.
No problems found yet.
So I guess for private themes – it is a good one.
Also I came up with a script for building versioned theme archive like this:
#!/bin/bash
echo "======================";
echo "BUILDING THEME ARCHIVE";
echo "======================";
# Get version from style.css and CHANGES.md and compare them.
# If they are the same - proceed.
VER_STYLE="$(cat style.css | grep 'Version: ' | perl -pe "s/Version: (.*)\\n/\1/g")"
VER_CHANGES="$(head -n 1 CHANGES.md | xargs | awk '{ print $2 }')"
if [ $VER_STYLE != $VER_CHANGES ]; then
printf "\e[31;5;21m%s\e[0m\n" "BUILD FAILED"
echo "Your version in style.css ($VER_STYLE) differs from version in CHANGES.md ($VER_CHANGES).";
echo "Please actualize.";
exit 1;
fi
# Theme archive build.
# Also create a new tag for builded version.
build_name="my-theme_$VER_STYLE.zip"
echo "Building $build_name ...";
zip -r -q \
--exclude=.* \
--exclude=sass/* \
--exclude=*/.DS_Store \
--exclude=*.md \
--exclude=*.zip \
--exclude=*.sh \
$build_name . && git tag $VER_STYLE && git push --tags && printf "\e[32;5;21m%s\e[0m\n" "done" ;
exit 0;