|
6 | 6 | # it does not exit with 0, as we are interested in the final exit. |
7 | 7 | set -eo |
8 | 8 |
|
| 9 | +# Function to check if a command exists |
| 10 | +command_exists() { |
| 11 | + command -v "$1" >/dev/null 2>&1 |
| 12 | +} |
| 13 | + |
| 14 | +# Check if SVN is installed |
| 15 | +if command_exists svn; then |
| 16 | + echo "SVN is already installed." |
| 17 | +else |
| 18 | + echo "SVN is not installed. Installing SVN..." |
| 19 | + |
| 20 | + # Update the package list |
| 21 | + sudo apt-get update -y |
| 22 | + |
| 23 | + # Install SVN |
| 24 | + sudo apt-get install -y subversion |
| 25 | + |
| 26 | + # Verify installation |
| 27 | + if command_exists svn; then |
| 28 | + echo "SVN was successfully installed." |
| 29 | + else |
| 30 | + echo "Failed to install SVN. Please check your system configuration." |
| 31 | + exit 1 |
| 32 | + fi |
| 33 | +fi |
| 34 | + |
9 | 35 | # Ensure SVN username and password are set |
10 | 36 | # IMPORTANT: while secrets are encrypted and not viewable in the GitHub UI, |
11 | 37 | # they are by necessity provided as plaintext in the context of the Action, |
@@ -44,12 +70,12 @@ echo "ℹ︎ ASSETS_DIR is $ASSETS_DIR" |
44 | 70 |
|
45 | 71 | if [[ -z "$BUILD_DIR" ]] || [[ $BUILD_DIR == "./" ]]; then |
46 | 72 | BUILD_DIR=false |
47 | | -elif [[ $BUILD_DIR == ./* ]]; then |
| 73 | +elif [[ $BUILD_DIR == ./* ]]; then |
48 | 74 | BUILD_DIR=${BUILD_DIR:2} |
49 | 75 | fi |
50 | 76 |
|
51 | 77 | if [[ "$BUILD_DIR" != false ]]; then |
52 | | - if [[ $BUILD_DIR != /* ]]; then |
| 78 | + if [[ $BUILD_DIR != /* ]]; then |
53 | 79 | BUILD_DIR="${GITHUB_WORKSPACE%/}/${BUILD_DIR%/}" |
54 | 80 | fi |
55 | 81 | echo "ℹ︎ BUILD_DIR is $BUILD_DIR" |
@@ -114,7 +140,7 @@ if [[ "$BUILD_DIR" = false ]]; then |
114 | 140 | git config --global user.name "10upbot on GitHub" |
115 | 141 |
|
116 | 142 | # Ensure git archive will pick up any changed files in the directory try. |
117 | | - test $(git ls-files --deleted) && git rm $(git ls-files --deleted) |
| 143 | + test "$(git ls-files --deleted)" && git rm "$(git ls-files --deleted)" |
118 | 144 | if [ -n "$(git status --porcelain --untracked-files=all)" ]; then |
119 | 145 | git add . |
120 | 146 | git commit -m "Include build step changes" |
|
0 commit comments