Skip to content

Commit 16af012

Browse files
authored
Merge pull request #122 from mukeshpanchal27/fix/121-add-debug-mode-support
Add `DRY RUN` mode support that can be used while testing
2 parents f45e3de + 1584f34 commit 16af012

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ This Action commits the contents of your Git tag to the WordPress.org plugin rep
1919
[Secrets are set in your repository settings](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). They cannot be viewed once stored.
2020

2121
### Optional environment variables
22-
* `SLUG` - defaults to the repository name, customizable in case your WordPress repository has a different slug or is capitalized differently.
23-
* `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes.
24-
* `ASSETS_DIR` - defaults to `.wordpress-org`, customizable for other locations of WordPress.org plugin repository-specific assets that belong in the top-level `assets` directory (the one on the same level as `trunk`).
25-
* `BUILD_DIR` - defaults to `false`. Set this flag to the directory where you build your plugins files into, then the action will copy and deploy files from that directory. Both absolute and relative paths are supported. The relative path if provided will be concatenated with the repository root directory. All files and folders in the build directory will be deployed, `.disignore` or `.gitattributes` will be ignored.
22+
* `SLUG` - Defaults to the repository name. This is customizable in case your WordPress repository has a different slug or is capitalized differently.
23+
* `VERSION` - Defaults to the tag name. We do not recommend setting this except for testing purposes.
24+
* `ASSETS_DIR` - Defaults to `.wordpress-org`. This is customizable for other locations of WordPress.org plugin repository-specific assets that belong in the top-level `assets` directory (the one on the same level as `trunk`).
25+
* `BUILD_DIR` - Defaults to `false`. Set this flag to the directory where you build your plugins files into, then the action will copy and deploy files from that directory. Both absolute and relative paths are supported. The relative path if provided will be concatenated with the repository root directory. All files and folders in the build directory will be deployed, `.disignore` or `.gitattributes` will be ignored.
2626

2727
### Inputs
28-
* `generate-zip` - Generate a ZIP file from the SVN `trunk` directory. Outputs a `zip-path` variable for use in further workflow steps. Defaults to false.
28+
* `generate-zip` - Defaults to `false`. Generate a ZIP file from the SVN `trunk` directory. Outputs a `zip-path` variable for use in further workflow steps.
29+
* `dry-run` - Defaults to `false`. Set this to `true` if you want to skip the final Subversion commit step (e.g., to debug prior to a non-dry-run commit).
2930

3031
### Outputs
3132
* `zip-path` - The path to the ZIP file generated if `generate-zip` is set to `true`. Fully qualified including the filename, intended for use in further workflow steps such as uploading release assets.

deploy.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ if [[ -z "$SVN_PASSWORD" ]]; then
2020
exit 1
2121
fi
2222

23+
if $INPUT_DRY_RUN; then
24+
echo "ℹ︎ Dry run: No files will be committed to Subversion."
25+
fi
26+
2327
# Allow some ENV variables to be customized
2428
if [[ -z "$SLUG" ]]; then
2529
SLUG=${GITHUB_REPOSITORY#*/}
@@ -157,8 +161,12 @@ svn update
157161

158162
svn status
159163

160-
echo "➤ Committing files..."
161-
svn commit -m "Update to version $VERSION from GitHub" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
164+
if $INPUT_DRY_RUN; then
165+
echo "➤ Dry run: Files not committed."
166+
else
167+
echo "➤ Committing files..."
168+
svn commit -m "Update to version $VERSION from GitHub" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
169+
fi
162170

163171
if $INPUT_GENERATE_ZIP; then
164172
echo "Generating zip file..."

0 commit comments

Comments
 (0)