2022-12-11 05:37:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
set -e
|
|
|
|
|
2022-12-11 05:37:08 +00:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2023-01-30 08:42:27 +00:00
|
|
|
if [[ -v "VIRTUAL_ENV" ]]; then
|
|
|
|
# we can't just call 'deactivate' because this function is not exported
|
|
|
|
# to the environment of this script from the bash process that runs the script
|
|
|
|
echo "A virtual environment is activated. Please deactivate it before proceeding".
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
2023-01-15 03:07:21 +00:00
|
|
|
VERSION=$(cd ..; python -c "from ldm.invoke import __version__ as version; print(version)")
|
2023-01-01 17:54:45 +00:00
|
|
|
PATCH=""
|
|
|
|
VERSION="v${VERSION}${PATCH}"
|
2022-12-11 05:37:08 +00:00
|
|
|
|
2023-01-15 03:07:21 +00:00
|
|
|
echo Building installer for version $VERSION
|
2022-12-11 05:37:08 +00:00
|
|
|
echo "Be certain that you're in the 'installer' directory before continuing."
|
|
|
|
read -p "Press any key to continue, or CTRL-C to exit..."
|
|
|
|
|
2023-02-04 02:50:32 +00:00
|
|
|
read -e -p "Commit and tag this repo with ${VERSION} and 'v2.3-latest'? [n]: " input
|
2023-01-15 00:28:14 +00:00
|
|
|
RESPONSE=${input:='n'}
|
|
|
|
if [ "$RESPONSE" == 'y' ]; then
|
|
|
|
git commit -a
|
|
|
|
|
|
|
|
if ! git tag $VERSION ; then
|
2023-01-15 03:07:21 +00:00
|
|
|
echo "Existing/invalid tag"
|
|
|
|
exit -1
|
2023-01-15 00:28:14 +00:00
|
|
|
fi
|
2023-02-04 02:50:32 +00:00
|
|
|
git push origin :refs/tags/v2.3-latest
|
2023-01-15 00:28:14 +00:00
|
|
|
git tag -fa latest
|
|
|
|
fi
|
2023-01-01 17:54:45 +00:00
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# ----------------------
|
|
|
|
|
|
|
|
echo Building the wheel
|
|
|
|
|
|
|
|
# install the 'build' package in the user site packages, if needed
|
|
|
|
# could be improved by using a temporary venv, but it's tiny and harmless
|
|
|
|
if [[ $(python -c 'from importlib.util import find_spec; print(find_spec("build") is None)') == "True" ]]; then
|
|
|
|
pip install --user build
|
|
|
|
fi
|
|
|
|
|
|
|
|
python -m build --wheel --outdir dist/ ../.
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
|
2023-01-01 17:54:45 +00:00
|
|
|
echo Building installer zip fles for InvokeAI $VERSION
|
2022-12-11 05:37:08 +00:00
|
|
|
|
|
|
|
# get rid of any old ones
|
2023-01-28 21:55:28 +00:00
|
|
|
rm -f *.zip
|
2022-12-11 05:37:08 +00:00
|
|
|
rm -rf InvokeAI-Installer
|
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# copy content
|
|
|
|
mkdir InvokeAI-Installer
|
|
|
|
for f in templates *.py *.txt *.reg; do
|
|
|
|
cp -r ${f} InvokeAI-Installer/
|
|
|
|
done
|
2022-12-11 05:37:08 +00:00
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# Move the wheel
|
|
|
|
mv dist/*.whl InvokeAI-Installer/
|
2022-12-11 05:37:08 +00:00
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# Install scripts
|
|
|
|
# Mac/Linux
|
2023-01-30 01:10:51 +00:00
|
|
|
cp install.sh.in InvokeAI-Installer/install.sh
|
|
|
|
chmod a+x InvokeAI-Installer/install.sh
|
2022-12-11 05:37:08 +00:00
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# Windows
|
2023-01-01 17:54:45 +00:00
|
|
|
perl -p -e "s/^set INVOKEAI_VERSION=.*/set INVOKEAI_VERSION=$VERSION/" install.bat.in > InvokeAI-Installer/install.bat
|
2022-12-11 05:37:08 +00:00
|
|
|
cp WinLongPathsEnabled.reg InvokeAI-Installer/
|
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# Zip everything up
|
|
|
|
zip -r InvokeAI-installer-$VERSION.zip InvokeAI-Installer
|
2022-12-11 05:37:08 +00:00
|
|
|
|
2023-01-28 21:55:28 +00:00
|
|
|
# Updater
|
2023-01-01 17:54:45 +00:00
|
|
|
mkdir tmp
|
|
|
|
cp templates/update.sh.in tmp/update.sh
|
|
|
|
cp templates/update.bat.in tmp/update.bat
|
|
|
|
chmod +x tmp/update.sh
|
|
|
|
chmod +x tmp/update.bat
|
|
|
|
cd tmp
|
|
|
|
zip InvokeAI-updater-$VERSION.zip update.sh update.bat
|
|
|
|
cd ..
|
|
|
|
mv tmp/InvokeAI-updater-$VERSION.zip .
|
|
|
|
|
2022-12-11 05:37:08 +00:00
|
|
|
# clean up
|
2023-01-28 21:55:28 +00:00
|
|
|
rm -rf InvokeAI-Installer tmp dist
|
2022-12-11 05:37:08 +00:00
|
|
|
|
|
|
|
exit 0
|