From 896395f14d60427112fdd4bbd8ba2400175c2d2b Mon Sep 17 00:00:00 2001 From: Pantheon Automation Date: Wed, 20 Dec 2023 18:58:30 +0000 Subject: [PATCH 1/3] Prepare 0.2.3-dev --- README.MD | 4 ++-- readme.txt | 7 +++++-- rossums-universal-robots.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.MD b/README.MD index b1a40ab..51c357b 100644 --- a/README.MD +++ b/README.MD @@ -5,7 +5,7 @@ Tags: comments, spam Requires at least: 4.5 Tested up to: 6.2.1 Requires PHP: 5.6 -Stable tag: 0.2.2 +Stable tag: 0.2.3-dev License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -13,7 +13,7 @@ See the robots hard at work. ## Changelog -### 0.2.2 (20 December 2023) +### 0.2.3-dev (20 December 2023) * Set Second Counter to 1 [[44](https://github.com/pantheon-systems/plugin-pipeline-example/pull/44)] ### 0.2.1 (20 December 2023) diff --git a/readme.txt b/readme.txt index 682e081..18aae4a 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: comments, spam Requires at least: 4.5 Tested up to: 6.2.1 Requires PHP: 5.6 -Stable tag: 0.2.2 +Stable tag: 0.2.3-dev License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -68,7 +68,10 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove == Changelog == -= 0.2.2 (20 December 2023) = += 0.2.3-dev = + + += 0.2.3-dev (20 December 2023) = * Set Second Counter to 1 [[44](https://github.com/pantheon-systems/plugin-pipeline-example/pull/44)] = 0.2.1 (20 December 2023) = diff --git a/rossums-universal-robots.php b/rossums-universal-robots.php index fbf3df4..d258b16 100644 --- a/rossums-universal-robots.php +++ b/rossums-universal-robots.php @@ -7,7 +7,7 @@ * Author URI: pantheon.io * Text Domain: rossums-universal-robots * Domain Path: /languages - * Version: 0.2.2 + * Version: 0.2.3-dev * * @package Rossums_Universal_Robots */ From 507459afba74be71d0fd8c16b8283737fb16da90 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Wed, 20 Dec 2023 11:26:22 -0800 Subject: [PATCH 2/3] Another prepare-dev search-replace pass (#45) --- .bin/prepare-dev.sh | 43 ----------------------------------- .bin/src/functions.sh | 44 +++++++++++++++++++++++++++++++----- README.MD | 8 +++++-- readme.txt | 9 ++++---- rossums-universal-robots.php | 11 +++++++-- 5 files changed, 58 insertions(+), 57 deletions(-) diff --git a/.bin/prepare-dev.sh b/.bin/prepare-dev.sh index b00ec37..5bbaf91 100644 --- a/.bin/prepare-dev.sh +++ b/.bin/prepare-dev.sh @@ -23,39 +23,6 @@ source "${SELF_DIRNAME}/src/functions.sh" readonly RELEASE_BRANCH="release" readonly DEVELOP_BRANCH="main" -process_file(){ - local FILE="${1:-}" - local OLD_VERSION="${2:-}" - local NEW_VERSION="${3:-}" - if [[ -z "${FILE}" ]] || [[ ! -f "$FILE" ]]; then - echo_info "No File '${FILE}'" - return - fi - echo "Checking file '${FILE}'..." - if [[ "$FILE" == "$BASE_DIR/package-lock.json" || "$FILE" == "$BASE_DIR/package.json" ]];then - echo_info "package and package-lock will be handled later." - return - fi - if [[ "$FILE" == "$BASE_DIR/composer.json" || "$FILE" == "$BASE_DIR/composer.lock" ]];then - echo_info "skip composer." - return - fi - - shopt -s nocasematch # make the "if readme" case insensitive - for readme_extension in "txt" "md"; do - if [[ "$file" == "${BASE_DIR}/readme.${readme_extension}" ]]; then - echo_info "skipping readme" - continue - fi - done - shopt -u nocasematch - - echo "search-and-replace with sed" - sed -i.tmp -e '/^\s*\* @since/!s/'"${OLD_VERSION}"'/'"${NEW_VERSION}"'/g' "$FILE" && rm "$FILE.tmp" - - git add "$FILE" -} - main() { local README_MD="${1:-}" if [[ -z "$README_MD" ]]; then @@ -86,21 +53,11 @@ main() { echo "Updating ${CURRENT_VERSION} to ${NEW_DEV_VERSION}" # Iterate through each file in the top-level directory for file in "$BASE_DIR"/*; do - if [[ "$file" == "$README_MD" || "$file" == "$README_TXT" ]]; then - echo_info "Don't process readme [${file}]." - continue - fi process_file "$file" "${CURRENT_VERSION}" "${NEW_DEV_VERSION}" done git_config - for readme in "$README_MD" "$README_TXT"; do - if [[ -f "${BASE_DIR}/${readme}" ]]; then - update_readme "${BASE_DIR}/${readme}" "${CURRENT_VERSION}" "${NEW_DEV_VERSION}" - fi - done - git commit -m "Prepare ${NEW_DEV_VERSION}" if [[ -f "$BASE_DIR/package.json" ]]; then diff --git a/.bin/src/functions.sh b/.bin/src/functions.sh index e3d4d26..d613920 100644 --- a/.bin/src/functions.sh +++ b/.bin/src/functions.sh @@ -35,6 +35,40 @@ git_config(){ git config user.name "${GIT_NAME}" } + +process_file(){ + local FILE="${1:-}" + local OLD_VERSION="${2:-}" + local NEW_VERSION="${3:-}" + if [[ -z "${FILE}" ]] || [[ ! -f "$FILE" ]]; then + echo_info "No File '${FILE}'" + return + fi + # Convert the filename to lowercase for case-insensitive comparison + LC_FILE_PATH=$(echo "$FILE_PATH" | tr '[:upper:]' '[:lower:]') + + echo "Processing file '${FILE}'..." + if [[ "$LC_FILE_PATH" == "$BASE_DIR/package-lock.json" || "$LC_FILE_PATH" == "$BASE_DIR/package.json" ]];then + echo_info "package and package-lock will be handled later [${FILE}]." + return + fi + if [[ "$LC_FILE_PATH" == "$BASE_DIR/composer.json" || "$LC_FILE_PATH" == "$BASE_DIR/composer.lock" ]];then + echo_info "skip composer [${FILE}]." + return + fi + if [[ "$LC_FILE_PATH" == *readme.* ]]; then + echo_info "Alternative readme Processing [${FILE}]." + update_readme "${FILE}" "${OLD_VERSION}" "${NEW_VERSION}" + echo_info "Skip futher readme sed" + return + fi + + echo "search-and-replace with sed" + sed -i.tmp -e '/^\s*\* @since/!s/'"${OLD_VERSION}"'/'"${NEW_VERSION}"'/g' "$FILE" && rm "$FILE.tmp" + + git add "$FILE" +} + update_readme(){ local FILE_PATH="${1:-}" local OLD_VERSION="${2:-}" @@ -43,12 +77,11 @@ update_readme(){ echo_error "usage: update_readme FILE_PATH OLD_VERSION NEW_VERSION" return 1 fi - - local EXTENSION=${FILE_PATH#"$BASE_DIR/readme."} - echo_info "adding new heading to readme.${EXTENSION}" - shopt -s nocasematch # make the "if" case insensitive - if [[ "$EXTENSION" == "md" ]]; then # there's gotta be a better way but whatever + # Convert the filename to lowercase for case-insensitive comparison + LC_FILE_PATH=$(echo "$FILE_PATH" | tr '[:upper:]' '[:lower:]') + + if [[ "$LC_FILE_PATH" == *.md ]]; then echo_info "markdown search-replace" local new_heading="### ${NEW_VERSION}" local awk_with_target='/## Changelog/ { print; print ""; print heading; print ""; next } 1' @@ -57,7 +90,6 @@ update_readme(){ local new_heading="= ${NEW_VERSION} =" local awk_with_target='/== Changelog ==/ { print; print ""; print heading; print ""; next } 1' fi - shopt -u nocasematch awk -v heading="$new_heading" "$awk_with_target" "$FILE_PATH" > tmp.md mv tmp.md "$FILE_PATH" diff --git a/README.MD b/README.MD index 51c357b..a0e6976 100644 --- a/README.MD +++ b/README.MD @@ -5,7 +5,7 @@ Tags: comments, spam Requires at least: 4.5 Tested up to: 6.2.1 Requires PHP: 5.6 -Stable tag: 0.2.3-dev +Stable tag: 0.3.0-dev License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -13,7 +13,11 @@ See the robots hard at work. ## Changelog -### 0.2.3-dev (20 December 2023) +### 0.3.0-dev +* Set Second Counter to 2 [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] +* Add RUR_VERSION Constant [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] + +### 0.2.2 (20 December 2023) * Set Second Counter to 1 [[44](https://github.com/pantheon-systems/plugin-pipeline-example/pull/44)] ### 0.2.1 (20 December 2023) diff --git a/readme.txt b/readme.txt index 18aae4a..ebd177f 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: comments, spam Requires at least: 4.5 Tested up to: 6.2.1 Requires PHP: 5.6 -Stable tag: 0.2.3-dev +Stable tag: 0.3.0-dev License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -68,10 +68,11 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove == Changelog == -= 0.2.3-dev = += 0.3.0-dev = +* Set Second Counter to 2 [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] +* Add RUR_VERSION Constant [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] - -= 0.2.3-dev (20 December 2023) = += 0.2.2 (20 December 2023) = * Set Second Counter to 1 [[44](https://github.com/pantheon-systems/plugin-pipeline-example/pull/44)] = 0.2.1 (20 December 2023) = diff --git a/rossums-universal-robots.php b/rossums-universal-robots.php index d258b16..5a8c3e2 100644 --- a/rossums-universal-robots.php +++ b/rossums-universal-robots.php @@ -7,11 +7,18 @@ * Author URI: pantheon.io * Text Domain: rossums-universal-robots * Domain Path: /languages - * Version: 0.2.3-dev + * Version: 0.3.0-dev * * @package Rossums_Universal_Robots */ +/** + * This plugin's latest version. + * + * @since 0.3.0-dev + */ +define( 'RUR_VERSION', '0.3.0-dev' ); + /** * Returns an int. It's a feature. * @@ -29,5 +36,5 @@ function rur_counter() { * @since 0.2.0 */ function rur_another_counter() { - return 1; + return 2; } From 77d169e940a27dece2af1d4bc67faf4e97b67c33 Mon Sep 17 00:00:00 2001 From: Pantheon Automation Date: Wed, 20 Dec 2023 19:26:37 +0000 Subject: [PATCH 3/3] Release 0.3.0 --- README.MD | 4 ++-- readme.txt | 4 ++-- rossums-universal-robots.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.MD b/README.MD index a0e6976..db79b8c 100644 --- a/README.MD +++ b/README.MD @@ -5,7 +5,7 @@ Tags: comments, spam Requires at least: 4.5 Tested up to: 6.2.1 Requires PHP: 5.6 -Stable tag: 0.3.0-dev +Stable tag: 0.3.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -13,7 +13,7 @@ See the robots hard at work. ## Changelog -### 0.3.0-dev +### 0.3.0 (20 December 2023) * Set Second Counter to 2 [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] * Add RUR_VERSION Constant [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] diff --git a/readme.txt b/readme.txt index ebd177f..f380ae1 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: comments, spam Requires at least: 4.5 Tested up to: 6.2.1 Requires PHP: 5.6 -Stable tag: 0.3.0-dev +Stable tag: 0.3.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -68,7 +68,7 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove == Changelog == -= 0.3.0-dev = += 0.3.0 (20 December 2023) = * Set Second Counter to 2 [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] * Add RUR_VERSION Constant [[#](https://github.com/pantheon-systems/plugin-pipeline-example/pull/#)] diff --git a/rossums-universal-robots.php b/rossums-universal-robots.php index 5a8c3e2..bf6b106 100644 --- a/rossums-universal-robots.php +++ b/rossums-universal-robots.php @@ -7,7 +7,7 @@ * Author URI: pantheon.io * Text Domain: rossums-universal-robots * Domain Path: /languages - * Version: 0.3.0-dev + * Version: 0.3.0 * * @package Rossums_Universal_Robots */ @@ -15,9 +15,9 @@ /** * This plugin's latest version. * - * @since 0.3.0-dev + * @since 0.3.0 */ -define( 'RUR_VERSION', '0.3.0-dev' ); +define( 'RUR_VERSION', '0.3.0' ); /** * Returns an int. It's a feature.