forked from mirror/earl-grey
86 lines
1.7 KiB
Bash
Executable File
86 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# This script is released into the public domain. Anyone is free to copy,
|
|
# modify, publish, or use this script for any purpose, commercial or
|
|
# non-commercial, and by any means. This notice applies only to this script
|
|
# and NOT any of the associated files. Please support open-source software!
|
|
|
|
minify_deps () {
|
|
npm install clean-css-cli
|
|
}
|
|
|
|
minify_prep () {
|
|
./.ci-gen-bash.sh minify_prep
|
|
}
|
|
|
|
gen_auto () {
|
|
echo "@media (prefers-color-scheme: light) {" > theme-committed-violet-auto.css
|
|
cat theme-committed-violet-light.css >> theme-committed-violet-auto.css
|
|
echo "}" >> theme-committed-violet-auto.css
|
|
echo "@media (prefers-color-scheme: dark) {" >> theme-committed-violet-auto.css
|
|
cat theme-committed-violet.css >> theme-committed-violet-auto.css
|
|
echo "}" >> theme-committed-violet-auto.css
|
|
}
|
|
|
|
gen_minify () {
|
|
./.ci-gen-bash.sh gen_minify
|
|
}
|
|
|
|
ci_early_clean () {
|
|
mv theme-committed-violet-auto.ccss theme-committed-violet-auto-unmin.css
|
|
rm *.ccss
|
|
rm -r node_modules/
|
|
rm package.json package-lock.json
|
|
}
|
|
|
|
ci_build_push () {
|
|
cp theme-committed-violet*.css build/
|
|
cd build
|
|
git config user.name $GIT_USERNAME
|
|
git config user.email $GIT_EMAIL
|
|
git add .
|
|
git commit -m "$COMMIT_MSG $CI_BUILD_CREATED" || true
|
|
git push
|
|
cd ..
|
|
rm -rf build/
|
|
}
|
|
|
|
case $1 in
|
|
"auto")
|
|
gen_auto
|
|
exit 0
|
|
;;
|
|
"minify-deps")
|
|
minify_deps
|
|
exit 0
|
|
;;
|
|
"minify-prep")
|
|
minify_prep
|
|
exit 0
|
|
;;
|
|
"minify")
|
|
gen_minify
|
|
exit 0
|
|
;;
|
|
"all")
|
|
gen_auto
|
|
gen_minify
|
|
exit 0
|
|
;;
|
|
"ci-clean")
|
|
ci_early_clean
|
|
exit 0
|
|
;;
|
|
"ci-build-push")
|
|
ci_build_push
|
|
exit 0
|
|
;;
|
|
"")
|
|
echo "usage: ./gen.sh <auto|minify-deps|minify-prep|minify|all>"
|
|
exit 1
|
|
;;
|
|
*)
|
|
echo "ERROR: Incorrect option > $1"
|
|
exit 2
|
|
;;
|
|
esac
|