Skip to content

Commit

Permalink
Add SVN as a part of the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kirtangajjar committed Jan 13, 2025
1 parent 408b966 commit 46096c6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
30 changes: 28 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@
# it does not exit with 0, as we are interested in 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

# Ensure SVN username and password are set
# IMPORTANT: while secrets are encrypted and not viewable in the GitHub UI,
# they are by necessity provided as plaintext in the context of the Action,
Expand Down Expand Up @@ -44,12 +70,12 @@ echo "ℹ︎ ASSETS_DIR is $ASSETS_DIR"

if [[ -z "$BUILD_DIR" ]] || [[ $BUILD_DIR == "./" ]]; then
BUILD_DIR=false
elif [[ $BUILD_DIR == ./* ]]; then
elif [[ $BUILD_DIR == ./* ]]; then
BUILD_DIR=${BUILD_DIR:2}
fi

if [[ "$BUILD_DIR" != false ]]; then
if [[ $BUILD_DIR != /* ]]; then
if [[ $BUILD_DIR != /* ]]; then
BUILD_DIR="${GITHUB_WORKSPACE%/}/${BUILD_DIR%/}"
fi
echo "ℹ︎ BUILD_DIR is $BUILD_DIR"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ jobs:
npm install
npm run build
- name: Install SVN ( Subversion )
run: |
sudo apt-get update
sudo apt-get install subversion
- name: WordPress Plugin Deploy

# You can add unique ids to specific steps if you want to reference their output later in the workflow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jobs:
run: |
npm install
npm run build
- name: Install SVN ( Subversion )
run: |
sudo apt-get update
sudo apt-get install subversion
- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
Expand All @@ -32,4 +28,4 @@ jobs:
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

6 changes: 1 addition & 5 deletions examples/deploy-on-pushing-a-new-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ jobs:
run: |
npm install
npm run build
- name: Install SVN ( Subversion )
run: |
sudo apt-get update
sudo apt-get install subversion
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: my-super-cool-plugin # optional, remove if GitHub repo name matches SVN slug, including capitalization

0 comments on commit 46096c6

Please sign in to comment.