Skip to content

Commit 4628e78

Browse files
authored
Merge pull request #160 from 10up/fix/install-svn
Add SVN as a part of the workflow
2 parents 408b966 + f49a36d commit 4628e78

4 files changed

Lines changed: 31 additions & 18 deletions

deploy.sh

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@
66
# it does not exit with 0, as we are interested in the final exit.
77
set -eo
88

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+
935
# Ensure SVN username and password are set
1036
# IMPORTANT: while secrets are encrypted and not viewable in the GitHub UI,
1137
# they are by necessity provided as plaintext in the context of the Action,
@@ -44,12 +70,12 @@ echo "ℹ︎ ASSETS_DIR is $ASSETS_DIR"
4470

4571
if [[ -z "$BUILD_DIR" ]] || [[ $BUILD_DIR == "./" ]]; then
4672
BUILD_DIR=false
47-
elif [[ $BUILD_DIR == ./* ]]; then
73+
elif [[ $BUILD_DIR == ./* ]]; then
4874
BUILD_DIR=${BUILD_DIR:2}
4975
fi
5076

5177
if [[ "$BUILD_DIR" != false ]]; then
52-
if [[ $BUILD_DIR != /* ]]; then
78+
if [[ $BUILD_DIR != /* ]]; then
5379
BUILD_DIR="${GITHUB_WORKSPACE%/}/${BUILD_DIR%/}"
5480
fi
5581
echo "ℹ︎ BUILD_DIR is $BUILD_DIR"
@@ -114,7 +140,7 @@ if [[ "$BUILD_DIR" = false ]]; then
114140
git config --global user.name "10upbot on GitHub"
115141

116142
# 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)"
118144
if [ -n "$(git status --porcelain --untracked-files=all)" ]; then
119145
git add .
120146
git commit -m "Include build step changes"

examples/deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ jobs:
5555
npm install
5656
npm run build
5757
58-
- name: Install SVN ( Subversion )
59-
run: |
60-
sudo apt-get update
61-
sudo apt-get install subversion
62-
6358
- name: WordPress Plugin Deploy
6459

6560
# You can add unique ids to specific steps if you want to reference their output later in the workflow.

examples/deploy-on-pushing-a-new-tag-and-create-release-with-attached-zip.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ jobs:
1414
run: |
1515
npm install
1616
npm run build
17-
- name: Install SVN ( Subversion )
18-
run: |
19-
sudo apt-get update
20-
sudo apt-get install subversion
2117
- name: WordPress Plugin Deploy
2218
id: deploy
2319
uses: 10up/action-wordpress-plugin-deploy@stable
@@ -32,4 +28,4 @@ jobs:
3228
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
3329
env:
3430
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
31+

examples/deploy-on-pushing-a-new-tag.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ jobs:
1313
run: |
1414
npm install
1515
npm run build
16-
- name: Install SVN ( Subversion )
17-
run: |
18-
sudo apt-get update
19-
sudo apt-get install subversion
2016
- name: WordPress Plugin Deploy
2117
uses: 10up/action-wordpress-plugin-deploy@stable
2218
env:
2319
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
2420
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
2521
SLUG: my-super-cool-plugin # optional, remove if GitHub repo name matches SVN slug, including capitalization
26-
22+

0 commit comments

Comments
 (0)