From 3e36aac816d32055cab2e9cb9590ef5b11dd4ff0 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Wed, 20 Dec 2023 14:13:27 -0800 Subject: [PATCH 1/4] prepare-dev --- README.MD | 4 +++- readme.txt | 4 +++- rossums-universal-robots.php | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index 64fc722..818e2ef 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.2 +Stable tag: 0.3.3-dev License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -13,6 +13,8 @@ See the robots hard at work. ## Changelog +### 0.3.3-dev + ### 0.3.2 (20 December 2023) * Set Counter to 7 [[52](https://github.com/pantheon-systems/plugin-pipeline-example/pull/52)] diff --git a/readme.txt b/readme.txt index 88946db..bfdb9a3 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.2 +Stable tag: 0.3.3-dev License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -68,6 +68,8 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove == Changelog == += 0.3.3-dev = + = 0.3.2 (20 December 2023) = * Set Counter to 7 [[52](https://github.com/pantheon-systems/plugin-pipeline-example/pull/52)] diff --git a/rossums-universal-robots.php b/rossums-universal-robots.php index 071c46c..5757781 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.2 + * Version: 0.3.3-dev * * @package Rossums_Universal_Robots */ @@ -17,7 +17,7 @@ * * @since 0.3.0 */ -define( 'RUR_VERSION', '0.3.2' ); +define( 'RUR_VERSION', '0.3.3-dev' ); /** * Returns an int. It's a feature. From 093307fd2a6e00719422e2c7f727d107c57b9dc1 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Wed, 20 Dec 2023 14:31:31 -0800 Subject: [PATCH 2/4] Use the new prepare-dev action (#54) --- .bin/prepare-dev.sh | 73 ----------------- .bin/src/functions.sh | 100 ------------------------ .github/workflows/build-tag-release.yml | 8 ++ Makefile | 2 +- README.MD | 12 +++ package-lock.json | 4 +- package.json | 2 +- 7 files changed, 24 insertions(+), 177 deletions(-) delete mode 100644 .bin/prepare-dev.sh delete mode 100644 .bin/src/functions.sh diff --git a/.bin/prepare-dev.sh b/.bin/prepare-dev.sh deleted file mode 100644 index 5bbaf91..0000000 --- a/.bin/prepare-dev.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -set -eou pipefail -set -x -IFS=$'\n\t' - -if [[ "${DRY_RUN:-}" == 1 ]]; then - echo "Dry Run. Will not Push." -fi - -# shellcheck disable=SC2155 -readonly SELF_DIRNAME="$(dirname -- "$0")" -readonly BASE_DIR="${SELF_DIRNAME}/.." - -# TODO: Parameterize or make case-insensitive when this is an action -# shellcheck disable=SC2034 -readonly GIT_USER="bot@getpantheon.com" -# shellcheck disable=SC2034 -readonly GIT_NAME="Pantheon Automation" - -# shellcheck disable=SC1091 -source "${SELF_DIRNAME}/src/functions.sh" - -readonly RELEASE_BRANCH="release" -readonly DEVELOP_BRANCH="main" - -main() { - local README_MD="${1:-}" - if [[ -z "$README_MD" ]]; then - README_MD=README.MD - fi - - local README_TXT="${2:-}" - if [[ -z "$README_TXT" ]]; then - README_TXT=readme.txt - fi - - local CURRENT_VERSION - CURRENT_VERSION="$(grep 'Stable tag:' < "${README_MD}" | awk '{print $3}')" - - # fetch all tags and history: - git fetch --tags --unshallow --prune - git branch --track main origin/main - - git checkout "${RELEASE_BRANCH}" - git pull origin "${RELEASE_BRANCH}" - git checkout "${DEVELOP_BRANCH}" - git pull origin "${DEVELOP_BRANCH}" - git rebase "${RELEASE_BRANCH}" - - local NEW_DEV_VERSION - NEW_DEV_VERSION=$(new_dev_version_from_current "$CURRENT_VERSION") - - echo "Updating ${CURRENT_VERSION} to ${NEW_DEV_VERSION}" - # Iterate through each file in the top-level directory - for file in "$BASE_DIR"/*; do - process_file "$file" "${CURRENT_VERSION}" "${NEW_DEV_VERSION}" - done - - git_config - - git commit -m "Prepare ${NEW_DEV_VERSION}" - - if [[ -f "$BASE_DIR/package.json" ]]; then - npm version "${NEW_DEV_VERSION}" --no-git-tag-version - fi - - if [[ "${DRY_RUN:-}" == 1 ]]; then - return - fi - git push origin "${DEVELOP_BRANCH}" -} - -main "$@" \ No newline at end of file diff --git a/.bin/src/functions.sh b/.bin/src/functions.sh deleted file mode 100644 index 06d12f5..0000000 --- a/.bin/src/functions.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -# no flags here, always source this file - - -## -# Expected Global Variables: -# - BASE_DIR -## -# echo to stderr with info tag -echo_info(){ - echo "[Info] $*" >&2 -} - -# echo to stderr with info tag -echo_error(){ - echo "[Error] $*" >&2 -} - -new_dev_version_from_current(){ - local CURRENT_VERSION="${1:-}" - if [[ -z "$CURRENT_VERSION" ]]; then - echo_error "No version passed to new_dev_version_from_current()" - return 1 - fi - - IFS='.' read -ra parts <<< "$CURRENT_VERSION" - local patch="${parts[2]}" - patch=$((patch + 1)) - local INCREMENTED="${parts[0]}.${parts[1]}.${patch}-dev" - echo "$INCREMENTED" -} - -git_config(){ - git config user.email "${GIT_USER}" - 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" | 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:-}" - local NEW_VERSION="${3:-}" - if [[ -z "${FILE_PATH}" || -z "${OLD_VERSION}" || -z "${NEW_VERSION}" ]]; then - echo_error "usage: update_readme FILE_PATH OLD_VERSION NEW_VERSION" - return 1 - fi - - # 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; next } 1' - else - echo_info "wp.org txt search-replace" - local new_heading="= ${NEW_VERSION} =" - local awk_with_target='/== Changelog ==/ { print; print ""; print heading; next } 1' - fi - - awk -v heading="$new_heading" "$awk_with_target" "$FILE_PATH" > tmp.md - mv tmp.md "$FILE_PATH" - - sed -i.tmp -e "s/Stable tag: ${OLD_VERSION}/Stable tag: ${NEW_VERSION}/g" "$FILE_PATH" && rm "$FILE_PATH.tmp" - - git add "$FILE_PATH" -} \ No newline at end of file diff --git a/.github/workflows/build-tag-release.yml b/.github/workflows/build-tag-release.yml index 4c2a464..27e234a 100644 --- a/.github/workflows/build-tag-release.yml +++ b/.github/workflows/build-tag-release.yml @@ -22,3 +22,11 @@ jobs: build_node_assets: "true" build_composer_assets: "true" draft: "false" + prepare_dev: + name: Update Dev environment for the next versions + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Prepare Dev + uses: pantheon-systems/plugin-release-actions/prepare-dev@main diff --git a/Makefile b/Makefile index 48e616f..0c400c1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ lint-shell: - shellcheck .bin/prepare-dev.sh .bin/release-pr.sh .bin/src/* + shellcheck .bin/release-pr.sh lint: lint-shell composer lint diff --git a/README.MD b/README.MD index 818e2ef..35a8f48 100644 --- a/README.MD +++ b/README.MD @@ -11,6 +11,18 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html See the robots hard at work. +## Actions Used + +### Development Workflow +* [Build/Tag/Release](https://github.com/pantheon-systems/plugin-release-actions/) +* [Prepare Dev](https://github.com/pantheon-systems/plugin-release-actions/) +* [Release to WordPress.org](https://github.com/10up/action-wordpress-plugin-deploy) (10up) + +### Linting and Testing +* [WordPress.org Code Analysis](https://github.com/pantheon-systems/action-wporg-validator/) +* [PHP Compatiblity](https://github.com/pantheon-systems/phpcompatibility-action/) +* [Validate Readme Spacing](https://github.com/pantheon-systems/validate-readme-spacing/) + ## Changelog ### 0.3.3-dev diff --git a/package-lock.json b/package-lock.json index 7f58208..9f4e40e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "plugin-pipeline-example", - "version": "0.2.0", + "version": "0.3.2-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "plugin-pipeline-example", - "version": "0.2.0", + "version": "0.3.2-dev", "license": "MIT", "dependencies": { "grunt": "^1.6.1", diff --git a/package.json b/package.json index f82201c..a5c3b11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plugin-pipeline-example", - "version": "0.2.0", + "version": "0.3.2-dev", "description": "A demo plugin to test and showcase github actions during plugin development and release", "main": "Gruntfile.js", "directories": { From 328d1bd1a433ac138c99dd3254830b4bb619f393 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Wed, 20 Dec 2023 14:35:51 -0800 Subject: [PATCH 3/4] Feature: The counter is now 8 (#55) --- README.MD | 1 + readme.txt | 1 + rossums-universal-robots.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 35a8f48..5fe5488 100644 --- a/README.MD +++ b/README.MD @@ -26,6 +26,7 @@ See the robots hard at work. ## Changelog ### 0.3.3-dev +* Set Counter to 8 [[55](https://github.com/pantheon-systems/plugin-pipeline-example/pull/55)] ### 0.3.2 (20 December 2023) * Set Counter to 7 [[52](https://github.com/pantheon-systems/plugin-pipeline-example/pull/52)] diff --git a/readme.txt b/readme.txt index bfdb9a3..484fee0 100644 --- a/readme.txt +++ b/readme.txt @@ -69,6 +69,7 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove == Changelog == = 0.3.3-dev = +* Set Counter to 8 [[55](https://github.com/pantheon-systems/plugin-pipeline-example/pull/55)] = 0.3.2 (20 December 2023) = * Set Counter to 7 [[52](https://github.com/pantheon-systems/plugin-pipeline-example/pull/52)] diff --git a/rossums-universal-robots.php b/rossums-universal-robots.php index 5757781..bf1dad7 100644 --- a/rossums-universal-robots.php +++ b/rossums-universal-robots.php @@ -26,7 +26,7 @@ * @since 0.1.1 */ function rur_counter() { - return 7; + return 8; } /** From ff34b2c7a5bb8c165c4ce2fbb1bdbf94328e28a1 Mon Sep 17 00:00:00 2001 From: Pantheon Automation Date: Wed, 20 Dec 2023 22:36:05 +0000 Subject: [PATCH 4/4] Release 0.3.3 --- README.MD | 4 ++-- readme.txt | 4 ++-- rossums-universal-robots.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.MD b/README.MD index 5fe5488..6e08fdb 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.3-dev +Stable tag: 0.3.3 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -25,7 +25,7 @@ See the robots hard at work. ## Changelog -### 0.3.3-dev +### 0.3.3 (20 December 2023) * Set Counter to 8 [[55](https://github.com/pantheon-systems/plugin-pipeline-example/pull/55)] ### 0.3.2 (20 December 2023) diff --git a/readme.txt b/readme.txt index 484fee0..448e5d4 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.3-dev +Stable tag: 0.3.3 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.3-dev = += 0.3.3 (20 December 2023) = * Set Counter to 8 [[55](https://github.com/pantheon-systems/plugin-pipeline-example/pull/55)] = 0.3.2 (20 December 2023) = diff --git a/rossums-universal-robots.php b/rossums-universal-robots.php index bf1dad7..1a7cf20 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.3-dev + * Version: 0.3.3 * * @package Rossums_Universal_Robots */ @@ -17,7 +17,7 @@ * * @since 0.3.0 */ -define( 'RUR_VERSION', '0.3.3-dev' ); +define( 'RUR_VERSION', '0.3.3' ); /** * Returns an int. It's a feature.