From 871ae37303b8b1a9a6df59574134c8592c53f4b2 Mon Sep 17 00:00:00 2001 From: Igor Zinovyev Date: Fri, 14 Jun 2024 20:37:44 +0300 Subject: [PATCH] Remove redundant bin scripts in the wpcomsh plugin. (#37880) * Removing obsolete scripts and makefile targets. * Changelog. --- projects/plugins/wpcomsh/Makefile | 12 +--- .../wpcomsh/bin/create-github-release.sh | 62 ------------------- .../plugins/wpcomsh/bin/update-version.php | 36 ----------- .../plugins/wpcomsh/bin/update-version.sh | 54 ---------------- .../remove-redundant-bin-scripts-wpcomsh | 4 ++ projects/plugins/wpcomsh/composer.json | 2 +- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 +- 8 files changed, 10 insertions(+), 166 deletions(-) delete mode 100755 projects/plugins/wpcomsh/bin/create-github-release.sh delete mode 100644 projects/plugins/wpcomsh/bin/update-version.php delete mode 100755 projects/plugins/wpcomsh/bin/update-version.sh create mode 100644 projects/plugins/wpcomsh/changelog/remove-redundant-bin-scripts-wpcomsh diff --git a/projects/plugins/wpcomsh/Makefile b/projects/plugins/wpcomsh/Makefile index 128f58d0f6855..be86383140640 100644 --- a/projects/plugins/wpcomsh/Makefile +++ b/projects/plugins/wpcomsh/Makefile @@ -108,16 +108,8 @@ i18n: @ git commit $(BUILD_SRC)/languages -m "Update language files" ## tag -tag: checkbeforetag - $(shell git tag v$(PLUGIN_VERSION_STRING)) - @ echo "tag v$(PLUGIN_VERSION_STRING) added." - @ echo $(PUSH_TAG) -ifeq ($(PUSH_RELEASE_TAG), true) - $(shell git push $(GIT_REMOTE_NAME) v$(PLUGIN_VERSION_STRING)) - @ echo "tag pushed to $(GIT_REMOTE_NAME)." -else - @ echo "run 'git push $(GIT_REMOTE_NAME) v$(PLUGIN_VERSION_STRING)' before creating the release" -endif +tag: + @ echo "This script is disabled, please use the 'tools/release-plugin.sh wpcomsh' script from the Monorepo root." ## CI & other testing test-public-access: build diff --git a/projects/plugins/wpcomsh/bin/create-github-release.sh b/projects/plugins/wpcomsh/bin/create-github-release.sh deleted file mode 100755 index 0786d39b2c1ec..0000000000000 --- a/projects/plugins/wpcomsh/bin/create-github-release.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -echo "Do not use this script anymore. Use the monorepo release tooling." >&2 -exit 1 -# Enable nicer messaging for build status. -BLUE_BOLD='\033[1;34m'; -GREEN_BOLD='\033[1;32m'; -RED_BOLD='\033[1;31m'; -YELLOW_BOLD='\033[1;33m'; -COLOR_RESET='\033[0m'; - -error () { - printf "\n🤯 ${RED_BOLD}$1${COLOR_RESET}\n" - exit 1 -} -status () { - printf "\n👩‍💻 ${BLUE_BOLD}$1${COLOR_RESET}\n" -} -success () { - printf "\n✅ ${GREEN_BOLD}$1${COLOR_RESET}\n" -} -warning () { - printf "\n${YELLOW_BOLD}$1${COLOR_RESET}\n" -} - -# We want to be in the root `wpcomsh` dir -cd `dirname "$0"` && cd .. - -# Test whether we're logged in to GitHub. -gh auth status --hostname github.com || exit 1 - -status "Creating GitHub release" - -CURRENTBRANCH=`git rev-parse --abbrev-ref HEAD` - -status "Reading the current version from wpcomsh.php" -VERSION=`awk '/[^[:graph:]]Version/{print $NF}' wpcomsh.php` -echo "Version that will be built and released is ${VERSION}" - -status "Making the build artifact" -make build - -ZIP_FILE="build/wpcomsh.${VERSION}.zip" - -if [ ! -r $ZIP_FILE ]; then - error "The build artifact could not be found at ${ZIP_FILE}" -fi - -status "Creating the release and attaching the build artifact" - -BRANCH="build/${VERSION}" -git checkout -b $BRANCH -gh release create --title "$VERSION" --notes "Release of version $VERSION. See README.md for details." "v${VERSION}" "${ZIP_FILE}" -STATUS=$? -git checkout $CURRENTBRANCH -git branch -D $BRANCH - -if [ "$STATUS" != 0 ]; then - error "Failed creating a release for ${VERSION}." -fi - -success "GitHub release complete." diff --git a/projects/plugins/wpcomsh/bin/update-version.php b/projects/plugins/wpcomsh/bin/update-version.php deleted file mode 100644 index 1ef220e1782ca..0000000000000 --- a/projects/plugins/wpcomsh/bin/update-version.php +++ /dev/null @@ -1,36 +0,0 @@ -version; - - $lines = array(); - $file = file( $filename ); - - foreach ( $file as $line ) { - if ( stripos( $line, ' * Version: ' ) !== false ) { - $line = " * Version: {$version}\n"; - } - if ( stripos( $line, "define( 'WPCOMSH_VERSION'," ) !== false ) { - $line = "define( 'WPCOMSH_VERSION', '{$version}' );\n"; - } - - $lines[] = $line; - } - - file_put_contents( $filename, $lines ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents -} - -replace_version( 'wpcomsh.php' ); diff --git a/projects/plugins/wpcomsh/bin/update-version.sh b/projects/plugins/wpcomsh/bin/update-version.sh deleted file mode 100755 index a306f9b5809da..0000000000000 --- a/projects/plugins/wpcomsh/bin/update-version.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ -set -euo pipefail - -# Enable nicer messaging for build status. -BLUE_BOLD='\033[1;34m'; -GREEN_BOLD='\033[1;32m'; -RED_BOLD='\033[1;31m'; -YELLOW_BOLD='\033[1;33m'; -COLOR_RESET='\033[0m'; - -error () { - printf "\n🤯 ${RED_BOLD}$1${COLOR_RESET}\n" -} -status () { - printf "\n👩‍💻 ${BLUE_BOLD}$1${COLOR_RESET}\n" -} -success () { - printf "\n✅ ${GREEN_BOLD}$1${COLOR_RESET}\n" -} -warning () { - printf "\n${YELLOW_BOLD}$1${COLOR_RESET}\n" -} - -SCRIPT_DIR=$(dirname "$(realpath "$0")" || true) -PACKAGE_JSON="$SCRIPT_DIR/../package.json" -CURRENT_VERSION=$(grep '"version":' "$PACKAGE_JSON" | awk -F '"' '{print $4}' || true) -if [ -n "$CURRENT_VERSION" ]; then - status "Current version is $CURRENT_VERSION" -fi - -status "Update version" - -echo "Enter the version number to update to, for example 1.0.0: " -read -r VERSION - -status "Bump version in package.json" -npm --no-git-tag-version version $VERSION || { - error "ERROR: Invalid version number." - exit 1 -} - -status "Bump version in other files" -php bin/update-version.php || { - error "Failed." - exit 1 -} - -status "Make sure the following changes have been made, then commit them and push them to a new PR." -echo "- package.json: new version number" -echo "- wpcomsh.php: new version numbers" -echo "\n" -git status diff --git a/projects/plugins/wpcomsh/changelog/remove-redundant-bin-scripts-wpcomsh b/projects/plugins/wpcomsh/changelog/remove-redundant-bin-scripts-wpcomsh new file mode 100644 index 0000000000000..ab4165f54b439 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/remove-redundant-bin-scripts-wpcomsh @@ -0,0 +1,4 @@ +Significance: patch +Type: removed + +Removed obsolete scripts and makefile targets. diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index ce867dc5dfdfc..26448f62748e9 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -125,7 +125,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ3_22_14" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ3_22_15_alpha" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index 80ae9d8a03def..2b3655e9c1df4 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "3.22.14", + "version": "3.22.15-alpha", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index ef5ac49f63375..e02db6e8081ce 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,7 +2,7 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 3.22.14 + * Version: 3.22.15-alpha * Author: Automattic * Author URI: http://automattic.com/ * @@ -10,7 +10,7 @@ */ // Increase version number if you change something in wpcomsh. -define( 'WPCOMSH_VERSION', '3.22.14' ); +define( 'WPCOMSH_VERSION', '3.22.15-alpha' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' );