diff --git a/build-zip.sh b/build-zip.sh index 988109b..645b3be 100755 --- a/build-zip.sh +++ b/build-zip.sh @@ -6,6 +6,32 @@ # it does not exit with a 0, and we only care about the final exit. set -eo +# Function to check if a command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Check if SVN is installed +if command_exists svn; then + echo "SVN is already installed." +else + echo "SVN is not installed. Installing SVN..." + + # Update the package list + sudo apt-get update -y + + # Install SVN + sudo apt-get install -y subversion + + # Verify installation + if command_exists svn; then + echo "SVN was successfully installed." + else + echo "Failed to install SVN. Please check your system configuration." + exit 1 + fi +fi + # Allow some ENV variables to be customized if [[ -z "$SLUG" ]]; then SLUG=${GITHUB_REPOSITORY#*/} @@ -61,7 +87,7 @@ if [[ "$BUILD_DIR" = false ]]; then # Ensure git archive will pick up any changed files in the directory. # See https://github.com/10up/action-wordpress-plugin-deploy/pull/130 - test $(git ls-files --deleted) && git rm $(git ls-files --deleted) + test "$(git ls-files --deleted)" && git rm "$(git ls-files --deleted)" if [ -n "$(git status --porcelain --untracked-files=all)" ]; then git add . git commit -m "Include build step changes"