ci: improve build scripts
This commit is contained in:
parent
ff7710c514
commit
e58ac5b4e0
2 changed files with 28 additions and 25 deletions
|
@ -4,7 +4,7 @@ echo "Building Plugin..."
|
||||||
|
|
||||||
# Moves everything including the style sheets over to `dist/`
|
# Moves everything including the style sheets over to `dist/`
|
||||||
echo "Copying directories..."
|
echo "Copying directories..."
|
||||||
rm -r dist/
|
rm -rf dist/
|
||||||
mkdir dist
|
mkdir dist
|
||||||
cp -r -t dist src/{class,languages,templates}/
|
cp -r -t dist src/{class,languages,templates}/
|
||||||
# Among the images, only 2 out of 3 are distributed.
|
# Among the images, only 2 out of 3 are distributed.
|
||||||
|
|
|
@ -27,29 +27,30 @@ if [[ $1 == "-c" ]]; then
|
||||||
read -p "You have passed the \`commit\` flag (\`-c\`). Did you mean to do this? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
read -p "You have passed the \`commit\` flag (\`-c\`). Did you mean to do this? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NB: To run on a branch other than `main`, uncomment this line:
|
# Unless forced to, the script will only run on the `main` branch.
|
||||||
#if false; then
|
if [[ $1 != "-f" ]]; then
|
||||||
|
|
||||||
# Step 1: Ensure the local copy has checked out the `main` branch
|
# Step 1: Ensure the local copy has checked out the `main` branch
|
||||||
|
|
||||||
if [[ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]]; then
|
if [[ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]]; then
|
||||||
echo "ERR: You are not on the \`main\` branch, please check it out and re-run this command."
|
echo "ERR: You are not on the \`main\` branch, please check it out and re-run this command."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "- \`main\` branch is checked out."
|
echo "- \`main\` branch is checked out."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 2: Ensure local copy of `main` is up-to-date with remote
|
# Step 2: Ensure local copy of `main` is up-to-date with remote
|
||||||
|
|
||||||
if [[ "$(git status | grep -c 'Your branch is up to date')" != 1 ]]; then
|
if [[ "$(git status | grep -c 'Your branch is up to date')" != 1 ]]; then
|
||||||
echo "ERR: Your local copy is not up-to-date with the remote, please update it and re-run this command."
|
echo "ERR: Your local copy is not up-to-date with the remote, please update it and re-run this command."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "- Local copy of \`main\` is up-to-date with remote."
|
echo "- Local copy of \`main\` is up-to-date with remote."
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NB: To run on a branch other than `main`, uncomment this line:
|
rm -rf ./{dist,tmp,svn-tmp}
|
||||||
#fi
|
|
||||||
|
|
||||||
# Step 3: Check versioning
|
# Step 3: Check versioning
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ fi
|
||||||
|
|
||||||
# Step 3(g): Check that the changelog is up-to-date
|
# Step 3(g): Check that the changelog is up-to-date
|
||||||
|
|
||||||
CHANGELOG_LATEST="$(awk -e '/== Changelog ==/,/= [0-9]+\.[0-9]+(\.[0-9]+)? =/' readme.txt | grep -Po '\d+\.\d+(\.\d+)?')"
|
CHANGELOG_LATEST="$(awk -e '/== Changelog ==/,/= [0-9]+\.[0-9]+(\.[0-9]+)? =/' src/readme.txt | grep -Po '\d+\.\d+(\.\d+)?')"
|
||||||
if [[ $CHANGELOG_LATEST != $DEVELOPMENT_VERSION ]]; then
|
if [[ $CHANGELOG_LATEST != $DEVELOPMENT_VERSION ]]; then
|
||||||
echo "ERR: Changelog is not up-to-date!"
|
echo "ERR: Changelog is not up-to-date!"
|
||||||
echo "Current version is $DEVELOPMENT_VERSION"
|
echo "Current version is $DEVELOPMENT_VERSION"
|
||||||
|
@ -176,14 +177,16 @@ echo -e "- Build complete.\n"
|
||||||
|
|
||||||
echo "- Setting pre-release version flags..."
|
echo "- Setting pre-release version flags..."
|
||||||
PRERELEASE_VERSION=$DEVELOPMENT_VERSION'p'
|
PRERELEASE_VERSION=$DEVELOPMENT_VERSION'p'
|
||||||
sed -i "s/$JS_VERSION/version : \"$PRERELEASE_VERSION\"/g" dist/js/wysiwyg-editor.js
|
sed -i "s/$JS_VERSION/$PRERELEASE_VERSION/g" dist/js/wysiwyg-editor.min.js
|
||||||
echo "- Pre-release flags set."
|
echo "- Pre-release flags set."
|
||||||
|
|
||||||
# Step 6: Tag the release
|
# Step 6: Tag the release
|
||||||
|
|
||||||
echo "- Tagging release..."
|
echo "- Tagging release..."
|
||||||
git tag -a $DEVELOPMENT_VERSION -m "Pre-release of version $DEVELOPMENT_VERSION"
|
git tag -a $DEVELOPMENT_VERSION -m "Pre-release of version $DEVELOPMENT_VERSION"
|
||||||
git push --tags
|
if [ $? != 0 ]; then echo "Tag already exists!"; exit 1; fi
|
||||||
|
git push --tags --no-verify
|
||||||
|
if [ $? != 0 ]; then echo "Push failed (tag probably exists on remote)!"; exit 1; fi
|
||||||
echo "- Release tagged."
|
echo "- Release tagged."
|
||||||
|
|
||||||
# Step 7: Push release to SVN repo.
|
# Step 7: Push release to SVN repo.
|
||||||
|
@ -227,8 +230,8 @@ echo "Stable version:"
|
||||||
echo -e '\t' $STABLE_VERSION '\n'
|
echo -e '\t' $STABLE_VERSION '\n'
|
||||||
echo -e "Commit message:\n"
|
echo -e "Commit message:\n"
|
||||||
echo -e "$CHANGELOG_MESSAGE" '\n'
|
echo -e "$CHANGELOG_MESSAGE" '\n'
|
||||||
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %
|
svn stat svn-tmp/trunk/ | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % >/dev/null
|
||||||
echo -e "Changes made to local \`trunk/\`:\n"
|
echo -e "Changes made to local \`trunk/\` (should only be 'M', 'D' and '?'):\n"
|
||||||
svn stat svn-tmp/trunk/
|
svn stat svn-tmp/trunk/
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\`readme.txt\` header:\n"
|
echo -e "\`readme.txt\` header:\n"
|
||||||
|
|
Reference in a new issue