Skip to content

Commit

Permalink
Set type of deploy only if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed May 31, 2024
1 parent 7ffc5f3 commit f98bbc8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/prerelease-changelog-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,29 @@ jobs:
# A 'package.json' can be in place for Plugins or modules, that uses any build or test runs.
if [ -f package.json ]; then
echo "Maybe UPDATE version in package.json: $NEW_VERSION"
sed -ri "s/(\"version\":[[:space:]]*\")[0-9]+\.[0-9]+\.[0-9]+(\")/\1$NEW_VERSION\2/g" package.json
echo "deploy=BUILD" >> "$GITHUB_OUTPUT"
if ! git diff --quiet --exit-code package.json; then
echo "Update version in package.json: $NEW_VERSION"
echo "deploy=BUILD" >> "$GITHUB_OUTPUT"
fi
fi
# A `plugin.php' is the most common and can be found in almost(!) every repository.
if [ -f plugin.php ]; then
echo "Maybe UPDATE version in plugin.php: $NEW_VERSION"
echo "UPDATE version in plugin.php: $NEW_VERSION"
# made with https://seddy.dev/
sed -ri "s/(Version:[[:space:]]*)[0-9]+\.[0-9]+\.[0-9]+/\1$NEW_VERSION/g" plugin.php
fi
# A 'readme.md' needs to be in place for regular Plugins hosted on wp.org/plugins.
if [ -f readme.md ]; then
echo "Maybe UPDATE version in readme.md: $NEW_VERSION"
echo "deploy=WPORG" >> "$GITHUB_OUTPUT"
sed -ri "s/(Stable tag:[[:space:]]*)[0-9]+\.[0-9]+\.[0-9]+/\1$NEW_VERSION/g" readme.md
if ! git diff --quiet --exit-code readme.md; then
echo "Update version in readme.md: $NEW_VERSION"
echo "deploy=WPORG" >> "$GITHUB_OUTPUT"
fi
fi
Expand All @@ -91,7 +97,7 @@ jobs:
# branch: ${{ github.event.release.target_commitish }}
branch: main
#unprotect_reviews: true # has anoying side-effect: settings stays disabled if workflow fails
acceptable_conclusions: success,skipped # A comma-separated list of acceptable statuses. If any of these statuses are present, the action will not fail.
acceptable_conclusions: success # A comma-separated list of acceptable statuses. If any of these statuses are present, the action will not fail.

#-----------------------------------------------------------------------------------------------------------------------

Expand Down

0 comments on commit f98bbc8

Please sign in to comment.