From 18093c4f1d257ce22c509f306cad62f61bdbfe3b Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Mon, 11 Dec 2023 21:08:03 -0500 Subject: [PATCH 1/2] split installer zipfile script from tagging script; add make commands --- Makefile | 33 +++++++++++++++++++++++- installer/create_installer.sh | 47 ----------------------------------- 2 files changed, 32 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index 24722e2264..309aeee4d5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,20 @@ # simple Makefile with scripts that are otherwise hard to remember # to use, run from the repo root `make ` +default: help + +help: + @echo Developer commands: + @echo + @echo "ruff Run ruff, fixing any safely-fixable errors and formatting" + @echo "ruff-unsafe Run ruff, fixing all fixable errors and formatting" + @echo "mypy Run mypy using the config in pyproject.toml to identify type mismatches and other coding errors" + @echo "mypy-all Run mypy ignoring the config in pyproject.tom but still ignoring missing imports" + @echo "frontend-build Build the frontend in order to run on localhost:9090" + @echo "frontend-dev Run the frontend in developer mode on localhost:5173" + @echo "installer-zip Build the installer .zip file for the current version" + @echo "tag-release Tag the GitHub repository with the current version (use at release time only!)" + # Runs ruff, fixing any safely-fixable errors and formatting ruff: ruff check . --fix @@ -18,4 +32,21 @@ mypy: # Runs mypy, ignoring the config in pyproject.toml but still ignoring missing (untyped) imports # (many files are ignored by the config, so this is useful for checking all files) mypy-all: - mypy scripts/invokeai-web.py --config-file= --ignore-missing-imports \ No newline at end of file + mypy scripts/invokeai-web.py --config-file= --ignore-missing-imports + +# Build the frontend +frontend-build: + cd invokeai/frontend/web && pnpm build + +# Run the frontend in dev mode +frontend-dev: + cd invokeai/frontend/web && pnpm dev + +# Installer zip file +installer-zip: + cd installer && ./create_installer.sh + +# Tag the release +tag-release: + cd installer && ./tag-release.sh + diff --git a/installer/create_installer.sh b/installer/create_installer.sh index ef489af751..ed8cbb0d0a 100755 --- a/installer/create_installer.sh +++ b/installer/create_installer.sh @@ -13,14 +13,6 @@ function is_bin_in_path { builtin type -P "$1" &>/dev/null } -function does_tag_exist { - git rev-parse --quiet --verify "refs/tags/$1" >/dev/null -} - -function git_show_ref { - git show-ref --dereference $1 --abbrev 7 -} - function git_show { git show -s --format='%h %s' $1 } @@ -53,50 +45,11 @@ VERSION=$( ) PATCH="" VERSION="v${VERSION}${PATCH}" -LATEST_TAG="v3-latest" - -echo "Building installer for version $VERSION..." -echo - -if does_tag_exist $VERSION; then - echo -e "${BCYAN}${VERSION}${RESET} already exists:" - git_show_ref tags/$VERSION - echo -fi -if does_tag_exist $LATEST_TAG; then - echo -e "${BCYAN}${LATEST_TAG}${RESET} already exists:" - git_show_ref tags/$LATEST_TAG - echo -fi echo -e "${BGREEN}HEAD${RESET}:" git_show echo -echo -e -n "Create tags ${BCYAN}${VERSION}${RESET} and ${BCYAN}${LATEST_TAG}${RESET} @ ${BGREEN}HEAD${RESET}, ${RED}deleting existing tags on remote${RESET}? " -read -e -p 'y/n [n]: ' input -RESPONSE=${input:='n'} -if [ "$RESPONSE" == 'y' ]; then - echo - echo -e "Deleting ${BCYAN}${VERSION}${RESET} tag on remote..." - git push origin :refs/tags/$VERSION - - echo -e "Tagging ${BGREEN}HEAD${RESET} with ${BCYAN}${VERSION}${RESET} locally..." - if ! git tag -fa $VERSION; then - echo "Existing/invalid tag" - exit -1 - fi - - echo -e "Deleting ${BCYAN}${LATEST_TAG}${RESET} tag on remote..." - git push origin :refs/tags/$LATEST_TAG - - echo -e "Tagging ${BGREEN}HEAD${RESET} with ${BCYAN}${LATEST_TAG}${RESET} locally..." - git tag -fa $LATEST_TAG - - echo - echo -e "${BYELLOW}Remember to 'git push origin --tags'!${RESET}" -fi - # ---------------------- FRONTEND ---------------------- pushd ../invokeai/frontend/web >/dev/null From f3a97e06ecd63c4978343e05dfacb47df549212e Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Mon, 11 Dec 2023 21:11:37 -0500 Subject: [PATCH 2/2] add the tag_release.sh script --- Makefile | 2 +- installer/tag_release.sh | 71 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100755 installer/tag_release.sh diff --git a/Makefile b/Makefile index 309aeee4d5..10d7a257c5 100644 --- a/Makefile +++ b/Makefile @@ -48,5 +48,5 @@ installer-zip: # Tag the release tag-release: - cd installer && ./tag-release.sh + cd installer && ./tag_release.sh diff --git a/installer/tag_release.sh b/installer/tag_release.sh new file mode 100755 index 0000000000..a914c1a505 --- /dev/null +++ b/installer/tag_release.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -e + +BCYAN="\e[1;36m" +BYELLOW="\e[1;33m" +BGREEN="\e[1;32m" +BRED="\e[1;31m" +RED="\e[31m" +RESET="\e[0m" + +function does_tag_exist { + git rev-parse --quiet --verify "refs/tags/$1" >/dev/null +} + +function git_show_ref { + git show-ref --dereference $1 --abbrev 7 +} + +function git_show { + git show -s --format='%h %s' $1 +} + +VERSION=$( + cd .. + python -c "from invokeai.version import __version__ as version; print(version)" +) +PATCH="" +MAJOR_VERSION=$(echo $VERSION | sed 's/\..*$//') +VERSION="v${VERSION}${PATCH}" +LATEST_TAG="v${MAJOR_VERSION}-latest" + +if does_tag_exist $VERSION; then + echo -e "${BCYAN}${VERSION}${RESET} already exists:" + git_show_ref tags/$VERSION + echo +fi +if does_tag_exist $LATEST_TAG; then + echo -e "${BCYAN}${LATEST_TAG}${RESET} already exists:" + git_show_ref tags/$LATEST_TAG + echo +fi + +echo -e "${BGREEN}HEAD${RESET}:" +git_show +echo + +echo -e -n "Create tags ${BCYAN}${VERSION}${RESET} and ${BCYAN}${LATEST_TAG}${RESET} @ ${BGREEN}HEAD${RESET}, ${RED}deleting existing tags on remote${RESET}? " +read -e -p 'y/n [n]: ' input +RESPONSE=${input:='n'} +if [ "$RESPONSE" == 'y' ]; then + echo + echo -e "Deleting ${BCYAN}${VERSION}${RESET} tag on remote..." + git push --delete origin $VERSION + + echo -e "Tagging ${BGREEN}HEAD${RESET} with ${BCYAN}${VERSION}${RESET} locally..." + if ! git tag -fa $VERSION; then + echo "Existing/invalid tag" + exit -1 + fi + + echo -e "Deleting ${BCYAN}${LATEST_TAG}${RESET} tag on remote..." + git push --delete origin $LATEST_TAG + + echo -e "Tagging ${BGREEN}HEAD${RESET} with ${BCYAN}${LATEST_TAG}${RESET} locally..." + git tag -fa $LATEST_TAG + + echo -e "Pushing updated tags to remote..." + git push origin --tags +fi +exit 0