Skip to content

Commit

Permalink
Merge pull request #8 from 10up/fix/install-svn
Browse files Browse the repository at this point in the history
Install `svn` if needed
  • Loading branch information
dkotter authored Feb 4, 2025
2 parents 1206c60 + 89995e4 commit da42f86
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion build-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#*/}
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit da42f86

Please sign in to comment.