ci: reflect new directory structure

This commit is contained in:
Ben Goldsworthy 2021-04-24 09:16:58 +01:00
parent ae9881deba
commit 8193f49d98
5 changed files with 48 additions and 59 deletions

View file

@ -14,22 +14,22 @@ echo "Running $(dirname "$0")/build-stylesheets.sh"
if [[ $1 == "-c" ]]; then
echo "Concatenating files and placing in \`css/tmp/\`..."
echo "Concatenating files and placing in \`tmp/css/\`..."
mkdir -p ./css/tmp
cat ./css/dev-common.css > ./css/tmp/footnotes-nottbrpl0.css
cat ./css/dev-{common,layout-reference-container}.css > ./css/tmp/footnotes-nottbrpl1.css
cat ./css/dev-{common,layout-entry-content}.css > ./css/tmp/footnotes-nottbrpl2.css
cat ./css/dev-{common,layout-main-content}.css > ./css/tmp/footnotes-nottbrpl3.css
cat ./css/dev-{common,tooltips}.css > ./css/tmp/footnotes-jqttbrpl0.css
cat ./css/dev-{common,tooltips,layout-reference-container}.css > ./css/tmp/footnotes-jqttbrpl1.css
cat ./css/dev-{common,tooltips,layout-entry-content}.css > ./css/tmp/footnotes-jqttbrpl2.css
cat ./css/dev-{common,tooltips,layout-main-content}.css > ./css/tmp/footnotes-jqttbrpl3.css
cat ./css/dev-{common,tooltips,tooltips-alternative}.css > ./css/tmp/footnotes-alttbrpl0.css
cat ./css/dev-{common,tooltips,tooltips-alternative,layout-reference-container}.css > ./css/tmp/footnotes-alttbrpl1.css
cat ./css/dev-{common,tooltips,tooltips-alternative,layout-entry-content}.css > ./css/tmp/footnotes-alttbrpl2.css
cat ./css/dev-{common,tooltips,tooltips-alternative,layout-main-content}.css > ./css/tmp/footnotes-alttbrpl3.css
cat ./css/settings.css > ./css/tmp/settings.css
mkdir -p ./tmp/css
cat ./src/css/dev-common.css > ./tmp/css/tmp/footnotes-nottbrpl0.css
cat ./src/css/dev-{common,layout-reference-container}.css > ./tmp/css/tmp/footnotes-nottbrpl1.css
cat ./src/css/dev-{common,layout-entry-content}.css > ./tmp/css/tmp/footnotes-nottbrpl2.css
cat ./src/css/dev-{common,layout-main-content}.css > ./tmp/css/tmp/footnotes-nottbrpl3.css
cat ./src/css/dev-{common,tooltips}.css > ./tmp/css/tmp/footnotes-jqttbrpl0.css
cat ./src/css/dev-{common,tooltips,layout-reference-container}.css > ./tmp/css/tmp/footnotes-jqttbrpl1.css
cat ./src/css/dev-{common,tooltips,layout-entry-content}.css > ./tmp/css/tmp/footnotes-jqttbrpl2.css
cat ./src/css/dev-{common,tooltips,layout-main-content}.css > ./tmp/css/tmp/footnotes-jqttbrpl3.css
cat ./src/css/dev-{common,tooltips,tooltips-alternative}.css > ./tmp/css/tmp/footnotes-alttbrpl0.css
cat ./src/css/dev-{common,tooltips,tooltips-alternative,layout-reference-container}.css > ./tmp/css/tmp/footnotes-alttbrpl1.css
cat ./src/css/dev-{common,tooltips,tooltips-alternative,layout-entry-content}.css > ./tmp/css/tmp/footnotes-alttbrpl2.css
cat ./src/css/dev-{common,tooltips,tooltips-alternative,layout-main-content}.css > ./tmp/css/tmp/footnotes-alttbrpl3.css
cat ./src/css/settings.css > ./tmp/css/tmp/settings.css
echo "Stylesheet concatenation complete."
exit 0
@ -42,7 +42,7 @@ elif [[ $1 == "-m" ]]; then
# `rmdir`, which will throw us an error if we have any minified files that
# haven't been moved over to `dist/css/` for whatever reason. As it currently
# stands, we have no error checking in place.
echo "Please minify the stylesheets in \`css/tmp/\`, saving them in the same location with the \`.min.css\` file extension."
echo "Please minify the stylesheets in \`tmp/css/\`, saving them in the same location with the \`.min.css\` file extension."
read -p "Are you ready to continue? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
exit 0
@ -53,17 +53,7 @@ elif [[ $1 == "-d" ]]; then
# files won't be removed from the source directory.
echo "Deploying minified stylesheets to \`dist/css/\`..."
mkdir -p ./dist/css
for f in ./css/tmp/*.min.css; do
filename=$(basename $f .css)
cp $f ./dist/css
#mv $f ./dist/css
echo -e '\t' $filename".css moved."
done
# NB: We currently distribute both the minified + concatenated and the
# unminified + unconcatenated stylesheets with the Plugin.
echo "Deploying development stylesheets to \`dist/css/\`..."
for f in ./css/dev-*.css; do
for f in ./tmp/css/*.min.css; do
filename=$(basename $f .css)
cp $f ./dist/css
#mv $f ./dist/css
@ -71,7 +61,7 @@ elif [[ $1 == "-d" ]]; then
done
#echo "Deleting temporary files..."
#rm -r ./css/tmp
#rm -r ./tmp/css/tmp
echo "All stylesheets added to build."
exit 0

View file

@ -6,15 +6,15 @@ echo "Building Plugin..."
echo "Copying directories..."
rm -r dist/
mkdir dist
cp -r -t dist class/ js/ languages/ templates/
cp -r -t dist src/{class,js,languages,templates}/
# Among the images, only 2 out of 3 are distributed.
echo "Copying the needed images..."
mkdir -p dist/img
cp -t dist/img img/fn-wysiwyg.png
cp -t dist/img src/img/fn-wysiwyg.png
echo "Copying files..."
cp -t dist license.txt readme.txt includes.php wpml-config.xml SECURITY.md CHANGELOG.md
cp -t dist src/{license.txt,readme.txt,includes.php,wpml-config.xml,SECURITY.md,CHANGELOG.md}
echo "Setting production flag..."
sed "s/'PRODUCTION_ENV', false/'PRODUCTION_ENV', true/g" footnotes.php > dist/footnotes.php
sed "s/'PRODUCTION_ENV', false/'PRODUCTION_ENV', true/g" src/footnotes.php > dist/footnotes.php
echo "Production flag set."
# TODO: once automatic minification is implemented, this should handle that.

View file

@ -62,26 +62,26 @@ fi
echo "- Checking versions..."
STABLE_TAG="$(grep "Stable Tag:" readme.txt)"
ROOT_HEADER_VERSION="$(grep " Version:" footnotes.php | grep -Po " Version: \d+\.\d+(\.\d+)?[a-z]?$")"
JS_VERSION="$(grep "version :" js/wysiwyg-editor.js)"
STABLE_TAG="$(grep "Stable Tag:" src/readme.txt)"
ROOT_HEADER_VERSION="$(grep " Version:" src/footnotes.php | grep -Po " Version: \d+\.\d+(\.\d+)?[a-z]?$")"
JS_VERSION="$(grep "version :" src/js/wysiwyg-editor.js)"
# Step 3(b): Check that all version declarations exists
if [[ -z $STABLE_TAG ]]; then
echo "ERR: No 'Stable Tag' field found in \`readme.txt\`!"
echo "ERR: No 'Stable Tag' field found in \`src/readme.txt\`!"
exit 1
else echo "- 'Stable Tag' field set in \`readme.txt\`."
else echo "- 'Stable Tag' field set in \`src/readme.txt\`."
fi
if [[ -z $ROOT_HEADER_VERSION ]]; then
echo "ERR: No 'Version' field found in \`footnotes.php\` file header!"
echo "ERR: No 'Version' field found in \`src/footnotes.php\` file header!"
exit 1
else echo "- 'Version' field set in \`footnotes.php\` file header."
else echo "- 'Version' field set in \`src/footnotes.php\` file header."
fi
if [[ -z $JS_VERSION ]]; then
echo "ERR: No \`version\` variable found in \`js/wysiwyg-editor.js\`!"
echo "ERR: No \`version\` variable found in \`src/js/wysiwyg-editor.js\`!"
exit 1
else echo "- \`version\` variable set in \`js/wysiwyg-editor.js\`."
else echo "- \`version\` variable set in \`src/js/wysiwyg-editor.js\`."
fi
# Step 3(c)(1): Check that all development versions match
@ -195,22 +195,22 @@ echo "For the time being, this part of the process shall remain (mostly) manual.
read -p "Are you ready to continue? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
echo "Creating local copy of SVN repo..."
svn checkout https://plugins.svn.wordpress.org/footnotes tmp --depth immediates
svn update --quiet tmp/trunk --set-depth infinity
svn update --quiet tmp/tags/$PRERELEASE_VERSION --set-depth infinity
svn checkout https://plugins.svn.wordpress.org/footnotes svn-tmp --depth immediates
svn update --quiet svn-tmp/trunk --set-depth infinity
svn update --quiet svn-tmp/tags/$PRERELEASE_VERSION --set-depth infinity
echo -e "Local copy created.\n"
# Step 7(b): Update `trunk/`
echo -e "Copying files from \`dist/\` to SVN \`trunk/\`...\n"
rsync -avhic dist/ tmp/trunk/ | grep -v "^\."
#rsync -avhic dist/ tmp/trunk/ --delete | grep -v "^\."
rsync -avhic dist/ svn-tmp/trunk/ --delete | grep -v "^\."
rsync -avhic assets/ svn-tmp/assets/ --delete | grep -v "^\."
read -p "Does the above list of changes (additions and deletions ONLY) look correct? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
echo -e "Copying complete.\n"
# Step 7(c): Set a release message
echo "Getting commit message from changelog..."
CHANGELOG_MESSAGE="$(awk -e "/= $DEVELOPMENT_VERSION =/,/= $STABLE_VERSION =/" readme.txt | grep '^-')"
CHANGELOG_MESSAGE="$(awk -e "/= $DEVELOPMENT_VERSION =/,/= $STABLE_VERSION =/" dist/readme.txt | grep '^-')"
echo -e "The changelog message for this version is:\n"
echo -e "$CHANGELOG_MESSAGE\n"
read -p "Is this correct? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
@ -229,21 +229,20 @@ echo -e "Commit message:\n"
echo -e "$CHANGELOG_MESSAGE" '\n'
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %
echo -e "Changes made to local \`trunk/\`:\n"
svn stat tmp/trunk/
svn stat svn-tmp/trunk/
echo ""
echo -e "\`readme.txt\` header:\n"
head tmp/trunk/readme.txt
head svn-tmp/trunk/readme.txt
echo ""
read -p "Is this all correct? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
# Step 7(d): Push to remote `trunk/` (provided the flag is set)
if [[ $1 == "-c" ]]; then
cd tmp && svn ci -m "$CHANGELOG_MESSAGE"
cd ..
cd svn-tmp && svn ci -m "$CHANGELOG_MESSAGE" && cd ..
else echo "- Commit flag not set, skipping commit step."
fi
# Step 8: Cleanup
#rm -rf {dist/,tmp/}
#rm -rf {dist/,svn-tmp/}

View file

@ -1,6 +1,6 @@
{
"name": "markcheret/footnotes",
"description": "footnotes aims to be the all-in-one solution for displaying an automatically-generated list of references on your WordPress Page or Post.",
"description": "footnotes lets you easily add highly-customisable footnotes on your WordPress Pages and Posts.",
"license": "GPL-3.0-only",
"scripts": {
"release": "./_tools/release.sh",
@ -10,8 +10,8 @@
"lint:fix": "composer run lint:php:fix && npm run lint:fix",
"format": "npm run format",
"format:fix": "npm run format:fix",
"lint:php": "./vendor/bin/phpcs --standard=WordPress --colors --encoding=utf-8 -n -p --ignore=./vendor,./node_modules ./*.php ./**/*.php && ./vendor/bin/phpcs --standard=PHPCompatibilityWP --runtime-set testVersion 7.0- --colors --encoding=utf-8 -n -p --ignore=./vendor,./node_modules ./*.php ./**/*.php",
"lint:php:fix": "./vendor/bin/phpcbf --standard=WordPress --encoding=utf-8 -p --ignore=./vendor,./node_modules ./*.php ./**/*.php && ./vendor/bin/phpcbf --standard=PHPCompatibilityWP --runtime-set testVersion 7.0- --encoding=utf-8 -p --ignore=./vendor,./node_modules ./*.php ./**/*.php",
"lint:php": "./vendor/bin/phpcs --standard=WordPress --colors --encoding=utf-8 -n -p src/**/*.php && ./vendor/bin/phpcs --standard=PHPCompatibilityWP --runtime-set testVersion 7.0- --colors --encoding=utf-8 -n -p src/**/*.php",
"lint:php:fix": "./vendor/bin/phpcbf --standard=WordPress --encoding=utf-8 -p src/**/*.php && ./vendor/bin/phpcbf --standard=PHPCompatibilityWP --runtime-set testVersion 7.0- --encoding=utf-8 -p src/**/*.php",
"lint:css": "npm run lint:css",
"lint:css:fix": "npm run lint:css:fix",
"lint:js": "npm run lint:js",

View file

@ -2,13 +2,13 @@
"scripts": {
"format": "npm run format:js",
"format:fix": "npm run format:js:fix",
"format:js": "prettier --config .prettierrc './js/*.js'",
"format:js": "prettier --config .prettierrc './src/**/*.js'",
"format:js:fix": "npm run format:js -- --write",
"lint": "npm run lint:js && npm run lint:css",
"lint:fix": "npm run lint:js:fix && npm run lint:css:fix",
"lint:js": "eslint \"./js/*.js\"",
"lint:js": "eslint \"./src/**/*.js\"",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:css": "stylelint \"./css/*.css\"",
"lint:css": "stylelint \"./src/**/*.css\"",
"lint:css:fix": "npm run lint:css -- --fix"
},
"devDependencies": {