Skip to content

Commit

Permalink
Merge pull request #160 from 10up/fix/install-svn
Browse files Browse the repository at this point in the history
Add SVN as a part of the workflow
  • Loading branch information
dkotter authored Jan 14, 2025
2 parents 408b966 + f49a36d commit 4628e78
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
32 changes: 29 additions & 3 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 Expand Up @@ -114,7 +140,7 @@ if [[ "$BUILD_DIR" = false ]]; then
git config --global user.name "10upbot on GitHub"

# Ensure git archive will pick up any changed files in the directory try.
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
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 4628e78

Please sign in to comment.