From f663fc227be3592b94e8fe21e23435141bd9b46d Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Wed, 12 Aug 2020 21:40:29 +0200 Subject: [PATCH 1/9] Replace "npx json" usage with "jq" --- bin/release_automation.sh | 8 +++++--- bin/release_prechecks.sh | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/release_automation.sh b/bin/release_automation.sh index ee31db702d..730f27c473 100755 --- a/bin/release_automation.sh +++ b/bin/release_automation.sh @@ -37,7 +37,7 @@ fi [[ -z "$(git status --porcelain)" ]] || { git status; printf "\nUncommitted changes found. Aborting release script...\n"; exit 1; } # Ask for new version number -CURRENT_VERSION_NUMBER=$(./node_modules/.bin/json -f package.json version) +CURRENT_VERSION_NUMBER=$(jq '.version' package.json --raw-output) echo "Current Version Number:$CURRENT_VERSION_NUMBER" read -p "Enter the new version number: " VERSION_NUMBER if [[ -z "$VERSION_NUMBER" ]]; then @@ -68,7 +68,9 @@ cd .. # Set version numbers for file in 'package.json' 'package-lock.json' 'gutenberg/packages/react-native-editor/package.json'; do - npx json -I -f "$file" -e "this.version='$VERSION_NUMBER'" || { echo "Error: could not update version in ${file}"; exit 1; } + TEMP_FILE=$(mktemp) + jq ".version = \"$VERSION_NUMBER\"" "$file" > "$TEMP_FILE" || { echo "Error: could not update version in ${file}"; exit 1; } + mv "$TEMP_FILE" "$file" done # Commit react-native-editor version update @@ -97,7 +99,7 @@ cd .. # Update the bundles -npm run bundle || { printf "\nError: 'npm bundle' failed.\nIf there is an error stating something like \"Command 'bundle' unrecognized.\" above, perhaps try running 'rm -rf node_modules gutenberg/node_modules && npm install'.\n"; exit 1; } +npm run bundle || { printf "\nError: 'npm bundle' failed.\nIf there is an error stating something like \"Command 'bundle' unrecognized.\" above, perhaps try running 'rm -rf node_modules gutenberg/node_modules && npm ci'.\n"; exit 1; } # Commit bundle changes along with any update to the gutenberg submodule (if necessary) git commit -a -m "Release script: Update bundle for: $VERSION_NUMBER" || { echo "Error: failed to commit changes"; exit 1; } diff --git a/bin/release_prechecks.sh b/bin/release_prechecks.sh index 0d1d06a5ad..55bc357db1 100755 --- a/bin/release_prechecks.sh +++ b/bin/release_prechecks.sh @@ -23,10 +23,9 @@ function confirm_to_proceed() { ##### function check_num_milestone_prs() { - MILESTONE_NAME="$1" - curl -s -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/wordpress-mobile/gutenberg-mobile/milestones" \ - | npx json -c "this.title === '$MILESTONE_NAME'" -a open_issues + MILESTONE_NAME="$1" + curl -s "https://api.github.com/repos/wordpress-mobile/gutenberg-mobile/milestones" \ + | jq ".[] | select(.title == \"$MILESTONE_NAME\") | .open_issues" } function check_if_version_has_pending_prs_for_milestone() { From 302e628202f7f910c7ebebd5a61312e586d5d14b Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Wed, 12 Aug 2020 22:43:10 +0200 Subject: [PATCH 2/9] Add string formatting, execute and abort utils --- bin/release_automation.sh | 84 ++++++++++++++++++--------------------- bin/release_prechecks.sh | 14 ------- bin/release_utils.sh | 58 +++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 60 deletions(-) diff --git a/bin/release_automation.sh b/bin/release_automation.sh index 730f27c473..5fdf658ac8 100755 --- a/bin/release_automation.sh +++ b/bin/release_automation.sh @@ -14,15 +14,15 @@ source bin/release_prechecks.sh source bin/release_utils.sh # Check that Github CLI is installed -command -v gh >/dev/null || { echo "Error: The Github CLI must be installed."; exit 1; } +command -v gh >/dev/null || abort "Error: The Github CLI must be installed." # Check that Aztec versions are set to release versions aztec_version_problems="$(check_android_and_ios_aztec_versions)" if [[ ! -z "$aztec_version_problems" ]]; then - printf "\nThere appear to be problems with the Aztec versions:\n$aztec_version_problems\n" + warn "There appear to be problems with the Aztec versions:\n$aztec_version_problems" confirm_to_proceed "Do you want to proceed with the release despite the ^above^ problem(s) with the Aztec version?" else - echo "Confirmed that Aztec Libraries are set to release versions. Proceeding..." + ohai "Confirmed that Aztec Libraries are set to release versions. Proceeding..." fi ## Check current branch is develop, main, or release/* branch @@ -34,19 +34,19 @@ if [[ ! "$CURRENT_BRANCH" =~ "^develop$|^main$|^release/.*" ]]; then fi # Confirm branch is clean -[[ -z "$(git status --porcelain)" ]] || { git status; printf "\nUncommitted changes found. Aborting release script...\n"; exit 1; } +[[ -z "$(git status --porcelain)" ]] || { git status; abort "Uncommitted changes found. Aborting release script..."; } # Ask for new version number CURRENT_VERSION_NUMBER=$(jq '.version' package.json --raw-output) echo "Current Version Number:$CURRENT_VERSION_NUMBER" read -p "Enter the new version number: " VERSION_NUMBER if [[ -z "$VERSION_NUMBER" ]]; then - echo "Version number cannot be empty." - exit 1 + abort "Version number cannot be empty." fi -# Insure javascript dependencies are up-to-date -npm ci || { echo "Error: 'npm ci' failed"; echo 1; } +# Ensure javascript dependencies are up-to-date +ohai "Run 'npm ci' to ensure javascript dependencies are up-to-date" +execute "npm" "ci" # If there are any open PRs with a milestone matching the release version number, notify the user and ask them if they want to proceed @@ -58,51 +58,59 @@ fi # Create Git branch RELEASE_BRANCH="release/$VERSION_NUMBER" -git switch -c "$RELEASE_BRANCH" || { echo "Error: could not create '$RELEASE_BRANCH' branch."; exit 1; } +ohai "Create Git branch '$RELEASE_BRANCH' in gutenberg-mobile." +execute "git" "switch" "-c" "$RELEASE_BRANCH" # Create Git branch in Gutenberg GB_RELEASE_BRANCH="rnmobile/release_$VERSION_NUMBER" +ohai "Create Git branch '$GB_RELEASE_BRANCH' in gutenberg." cd gutenberg -git switch -c "$GB_RELEASE_BRANCH" || { echo "Error: could not create '$GB_RELEASE_BRANCH' branch."; exit 1; } +execute "git" "switch" "-c" "$GB_RELEASE_BRANCH" cd .. # Set version numbers -for file in 'package.json' 'package-lock.json' 'gutenberg/packages/react-native-editor/package.json'; do +ohai "Set version numbers in package.json files" +for file in 'package.json' 'package-lock.json' 'gutenberg/packages/react-native-aztec/package.json' 'gutenberg/packages/react-native-bridge/package.json' 'gutenberg/packages/react-native-editor/package.json'; do TEMP_FILE=$(mktemp) - jq ".version = \"$VERSION_NUMBER\"" "$file" > "$TEMP_FILE" || { echo "Error: could not update version in ${file}"; exit 1; } - mv "$TEMP_FILE" "$file" + execute "jq" ".version = \"$VERSION_NUMBER\"" "$file" > "$TEMP_FILE" + execute "mv" "$TEMP_FILE" "$file" done -# Commit react-native-editor version update +# Commit react-native-aztec, react-native-bridge, react-native-editor version update +ohai "Commit react-native-aztec, react-native-bridge, react-native-editor version update version update" cd gutenberg -git add 'packages/react-native-editor/package.json' -git commit -m "Release script: Update react-native-editor version to $VERSION_NUMBER" || { echo "Error: failed to commit changes"; exit 1; } +git add 'packages/react-native-aztec/package.json' 'packages/react-native-bridge/package.json' 'packages/react-native-editor/package.json' +execute "git" "commit" "-m" "Release script: Update react-native-editor version to $VERSION_NUMBER" cd .. # Commit gutenberg-mobile version updates +ohai "Commit gutenberg-mobile version updates" git add 'package.json' 'package-lock.json' -git commit -m "Release script: Update gb mobile version to $VERSION_NUMBER" || { echo "Error: failed to commit changes"; exit 1; } - +execute "git" "commit" "-m" "Release script: Update gb mobile version to $VERSION_NUMBER" # Make sure podfile is updated +ohai "Make sure podfile is updated" PRE_IOS_COMMAND="npm run core preios" eval "$PRE_IOS_COMMAND" # If preios results in changes, commit them cd gutenberg if [[ ! -z "$(git status --porcelain)" ]]; then - git commit -a -m "Release script: Update with changes from '$PRE_IOS_COMMAND'" || { echo "Error: failed to commit changes from '$PRE_IOS_COMMAND'"; exit 1; } + ohai "Commit changes from '$PRE_IOS_COMMAND'" + execute "git" "commit" "-a" "-m" "Release script: Update with changes from '$PRE_IOS_COMMAND'" else - echo "There were no changes from '$PRE_IOS_COMMAND' to be committed." + ohai "There were no changes from '$PRE_IOS_COMMAND' to be committed." fi cd .. # Update the bundles -npm run bundle || { printf "\nError: 'npm bundle' failed.\nIf there is an error stating something like \"Command 'bundle' unrecognized.\" above, perhaps try running 'rm -rf node_modules gutenberg/node_modules && npm ci'.\n"; exit 1; } +ohai "Update the bundles" +npm run bundle || abort "Error: 'npm bundle' failed.\nIf there is an error stating something like \"Command 'bundle' unrecognized.\" above, perhaps try running 'rm -rf node_modules gutenberg/node_modules && npm ci'." # Commit bundle changes along with any update to the gutenberg submodule (if necessary) -git commit -a -m "Release script: Update bundle for: $VERSION_NUMBER" || { echo "Error: failed to commit changes"; exit 1; } +ohai "Commit bundle changes along with any update to the gutenberg submodule (if necessary)" +execute "git" "commit" "-a" "-m" "Release script: Update bundle for: $VERSION_NUMBER" ##### @@ -110,15 +118,8 @@ git commit -a -m "Release script: Update bundle for: $VERSION_NUMBER" || { echo ##### # Verify before creating PRs -echo "This script will now create a Gutenberg-Mobile PR for the $RELEASE_BRANCH branch and a Gutenberg PR for the $GB_RELEASE_BRANCH branch." -read -p "Would you like to proceed? (y/n) " -n 1 -if [[ $REPLY =~ ^[Yy]$ ]]; then - printf "\n\nProceeding to create a PR...\n" -else - printf "\n\nFinishing release script without creating a PR\n" - exit 1 -fi - +confirm_to_proceed "Do you want to proceed with creating a Gutenberg-Mobile PR for the $RELEASE_BRANCH branch and a Gutenberg PR for the $GB_RELEASE_BRANCH branch." +ohai "Proceeding to create PRs..." ##### # Gutenberg-Mobile PR @@ -126,7 +127,7 @@ fi # Read GB-Mobile PR template PR_TEMPLATE_PATH='.github/PULL_REQUEST_TEMPLATE/release_pull_request.md' -test -f "$PR_TEMPLATE_PATH" || { echo "Error: Could not find PR template at $PR_TEMPLATE_PATH"; exit 1; } +test -f "$PR_TEMPLATE_PATH" || abort "Error: Could not find PR template at $PR_TEMPLATE_PATH" PR_TEMPLATE=$(cat "$PR_TEMPLATE_PATH") # Replace version number in GB-Mobile PR template @@ -135,15 +136,10 @@ PR_BODY=${PR_TEMPLATE//v1.XX.Y/$VERSION_NUMBER} # Insure PR is created on proper remote # see https://github.com/cli/cli/issues/800 BASE_REMOTE=$(get_remote_name 'wordpress-mobile/gutenberg-mobile') -git push -u "$BASE_REMOTE" HEAD || { echo "Unable to push to remote $BASE_REMOTE"; exit 1; } +execute "git" "push" "-u" "$BASE_REMOTE" "HEAD" # Create Draft GB-Mobile Release PR in GitHub -GB_MOBILE_PR_URL=$(gh pr create --title "Release $VERSION_NUMBER" --body "$PR_BODY" --base main --label "release-process" --draft) -if [[ $? != 0 ]]; then - echo "Error: Failed to create Gutenberg-Mobile PR" - exit 1 -fi - +GB_MOBILE_PR_URL=$("gh" "pr" "create" "--title" "Release $VERSION_NUMBER" "--body" "$PR_BODY" "--base" "main" "--label" "release-process" "--draft") ##### # Gutenberg PR @@ -152,7 +148,7 @@ fi # Get Checklist from Gutenberg PR template cd gutenberg GUTENBERG_PR_TEMPLATE_PATH=".github/PULL_REQUEST_TEMPLATE.md" -test -f "$GUTENBERG_PR_TEMPLATE_PATH" || { echo "Error: Could not find PR template at $GUTENBERG_PR_TEMPLATE_PATH"; exit 1; } +test -f "$GUTENBERG_PR_TEMPLATE_PATH" || abort "Error: Could not find PR template at $GUTENBERG_PR_TEMPLATE_PATH" # Get the checklist from the gutenberg PR template by removing everything before the '## Checklist:' line CHECKLIST_FROM_GUTENBERG_PR_TEMPLATE=$(cat "$GUTENBERG_PR_TEMPLATE_PATH" | sed -e/'## Checklist:'/\{ -e:1 -en\;b1 -e\} -ed) @@ -168,14 +164,10 @@ $CHECKLIST_FROM_GUTENBERG_PR_TEMPLATE" # Insure PR is created on proper remote # see https://github.com/cli/cli/issues/800 GB_BASE_REMOTE=$(get_remote_name 'WordPress/gutenberg') -git push -u "$GB_BASE_REMOTE" HEAD || { echo "Unable to push to remote: $GB_BASE_REMOTE"; exit 1; } +execute "git" "push" "-u" "$GB_BASE_REMOTE" "HEAD" # Create Draft Gutenberg Release PR in GitHub -GUTENBERG_PR_URL=$(gh pr create --title "Mobile Release v$VERSION_NUMBER" --body "$GUTENBERG_PR_BODY" --base master --label 'Mobile App Android/iOS' --draft) -if [[ $? != 0 ]]; then - echo "Error: Failed to create Gutenberg PR" - exit 1 -fi +GUTENBERG_PR_URL=$("gh" "pr" "create" "--title" "Mobile Release v$VERSION_NUMBER" "--body" "$GUTENBERG_PR_BODY" "--base" "master" "--label" "Mobile App Android/iOS" "--draft") cd .. echo "PRs Created" diff --git a/bin/release_prechecks.sh b/bin/release_prechecks.sh index 55bc357db1..52d0741ae4 100755 --- a/bin/release_prechecks.sh +++ b/bin/release_prechecks.sh @@ -4,20 +4,6 @@ SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" cd "$SCRIPT_PATH/.." -##### -# Confirm to Proceed Prompt -##### - -# Accepts a single argument: a yes/no question (ending with a ? most likely) to ask the user -function confirm_to_proceed() { - read -p "$1 (y/n) " -n 1 - echo "" - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - printf "Aborting release...\n" - exit 1 - fi -} - ##### # PR Milestone check ##### diff --git a/bin/release_utils.sh b/bin/release_utils.sh index 4d02e7bcf1..ecce05a3b6 100644 --- a/bin/release_utils.sh +++ b/bin/release_utils.sh @@ -6,3 +6,61 @@ function get_remote_name() { REPO="$1" git remote -v | grep "git@github.com:$REPO.git (push)" | grep -oE '^\S*' } + + +# Utils adapted from https://github.com/Homebrew/install/blob/master/install.sh +if [[ -t 1 ]]; then + tty_escape() { printf "\033[%sm" "$1"; } +else + tty_escape() { :; } +fi +tty_mkbold() { tty_escape "1;$1"; } +tty_underline="$(tty_escape "4;39")" +tty_blue="$(tty_mkbold 34)" +tty_red="$(tty_mkbold 31)" +tty_bold="$(tty_mkbold 39)" +tty_reset="$(tty_escape 0)" + + +shell_join() { + local arg + printf "%s" "$1" + shift + for arg in "$@"; do + printf " " + printf "%s" "${arg// /\ }" + done +} + +ohai() { + printf "${tty_blue}==> %s${tty_reset}\n" "$(shell_join "$@")" +} + +warn() { + printf "${tty_red}Warning${tty_reset}: %s\n" +} + +abort() { + printf "\n${tty_red}%s${tty_reset}\n" "$1" + exit 1 +} + +execute() { + if ! "$@"; then + abort "$(printf "Failed during: %s" "$(shell_join "$@")")" + fi +} + + +##### +# Confirm to Proceed Prompt +##### + +# Accepts a single argument: a yes/no question (ending with a ? most likely) to ask the user +function confirm_to_proceed() { + read -p "$1 (y/n) " -n 1 + echo "" + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + abort "Aborting release..." + fi +} From 21a2b10558957771c29e02b0ea03a5b7ba38ebde Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Mon, 17 Aug 2020 16:07:42 +0200 Subject: [PATCH 3/9] Create WPiOS and WPAndroid PRs --- bin/release_automation.sh | 101 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/bin/release_automation.sh b/bin/release_automation.sh index 5fdf658ac8..7991193a2e 100755 --- a/bin/release_automation.sh +++ b/bin/release_automation.sh @@ -174,3 +174,104 @@ echo "PRs Created" echo "===========" printf "Gutenberg-Mobile $GB_MOBILE_PR_URL Gutenberg $GUTENBERG_PR_URL\n" | column -t + +confirm_to_proceed "Do you want to proceed with creating main apps (WPiOS and WPAndroid) PRs?" +ohai "Proceeding to create main apps PRs..." + +GB_MOBILE_PR_REF=$(git rev-parse HEAD) + +##### +# WPAndroid PR +##### + +TEMP_WP_ANDROID_DIRECTORY=$(mktemp -d) +ohai "Clone WordPress-Android into '$TEMP_WP_ANDROID_DIRECTORY'" +execute "git" "clone" "--depth=1" "git@github.com:wordpress-mobile/WordPress-Android.git" "$TEMP_WP_ANDROID_DIRECTORY" + +cd "$TEMP_WP_ANDROID_DIRECTORY" + +execute "git" "submodule" "update" "--init" "--recursive" "--depth=1" "--recommend-shallow" + +ohai "Create release branch in WordPress-Android" +execute "git" "switch" "-c" "gutenberg/integrate_release_$VERSION_NUMBER" + +ohai "Update gutenberg-mobile ref" +cd libs/gutenberg-mobile +execute "git" "fetch" "--recurse-submodules=no" "origin" "$GB_MOBILE_PR_REF" +execute "git" "checkout" "$GB_MOBILE_PR_REF" +cd ../.. + +execute "git" "add" "libs/gutenberg-mobile" +execute "git" "commit" "-m" "Release script: Update gutenberg-mobile ref" + +ohai "Update strings" +execute "python" "tools/merge_strings_xml.py" +execute "git" "add" "WordPress/src/main/res/values/strings.xml" +execute "git" "commit" "-m" "Release script: Update strings" + +# Insure PR is created on proper remote +# see https://github.com/cli/cli/issues/800 +WP_ANDROID_BASE_REMOTE=$(get_remote_name 'wordpress-mobile/WordPress-android') +execute "git" "push" "-u" "$WP_ANDROID_BASE_REMOTE" "HEAD" + +WP_ANDROID_PR_BODY="## Description +This PR incorporates the $VERSION_NUMBER release of gutenberg-mobile. +For more information about this release and testing instructions, please see the related Gutenberg-Mobile PR: $GB_MOBILE_PR_URL + +Release Submission Checklist + +- [ ] I have considered if this change warrants user-facing release notes and have added them to `RELEASE-NOTES.txt` if necessary." + +# Create Draft WPAndroid Release PR in GitHub +ohai "Create Draft WPAndroid Release PR in GitHub" +WP_ANDROID_PR_URL=$(execute "gh" "pr" "create" "--title" "Integrate gutenberg-mobile release $VERSION_NUMBER" "--body" "$WP_ANDROID_PR_BODY" "--base" "develop" "--label" "gutenberg-mobile" "--draft") + +ohai "WPAndroid PR Created: $WP_ANDROID_PR_URL" + + +##### +# WPiOS PR +##### + +TEMP_WP_IOS_DIRECTORY=$(mktemp -d) +ohai "Clone WordPress-iOS into '$TEMP_WP_IOS_DIRECTORY'" +execute "git" "clone" "--depth=1" "git@github.com:wordpress-mobile/WordPress-iOS.git" "$TEMP_WP_IOS_DIRECTORY" + +cd "$TEMP_WP_IOS_DIRECTORY" + +ohai "Create release branch in WordPress-iOS" +execute "git" "switch" "-c" "gutenberg/integrate_release_$VERSION_NUMBER" + +ohai "Update gutenberg-mobile ref" +test -f "Podfile" || abort "Error: Could not find Podfile" +sed -i'.orig' -E "s/gutenberg :commit => '(.*)'/gutenberg :commit => '$GB_MOBILE_PR_REF'/" Podfile || abort "Error: Failed updating gutenberg ref in Podfile" +execute "rake" "dependencies" + + +execute "git" "add" "Podfile" "Podfile.lock" +execute "git" "commit" "-m" "Release script: Update gutenberg-mobile ref" + +# Insure PR is created on proper remote +# see https://github.com/cli/cli/issues/800 +WP_IOS_BASE_REMOTE=$(get_remote_name 'wordpress-mobile/WordPress-iOS') +execute "git" "push" "-u" "$WP_IOS_BASE_REMOTE" "HEAD" + +WP_IOS_PR_BODY="## Description +This PR incorporates the $VERSION_NUMBER release of gutenberg-mobile. +For more information about this release and testing instructions, please see the related Gutenberg-Mobile PR: $GB_MOBILE_PR_URL + +Release Submission Checklist + +- [ ] I have considered if this change warrants user-facing release notes and have added them to `RELEASE-NOTES.txt` if necessary." + +# Create Draft WPiOS Release PR in GitHub +ohai "Create Draft WPiOS Release PR in GitHub" +WP_IOS_PR_URL=$(execute "gh" "pr" "create" "--title" "Integrate gutenberg-mobile release $VERSION_NUMBER" "--body" "$WP_IOS_PR_BODY" "--base" "develop" "--label" "Gutenberg integration" "--draft") + +ohai "WPiOS PR Created: $WP_IOS_PR_URL" + +echo "Main apps PRs created" +echo "===========" +printf "WPAndroid $WP_ANDROID_PR_URL +WPiOS $WP_IOS_PR_URL\n" | column -t + From 71a41a82cab45360dcde724ff025e7ae9c05bf80 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Mon, 17 Aug 2020 18:32:06 +0200 Subject: [PATCH 4/9] Fix gutenberg PR creation commands --- bin/release_automation.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/release_automation.sh b/bin/release_automation.sh index 7991193a2e..8c65ec4ad4 100755 --- a/bin/release_automation.sh +++ b/bin/release_automation.sh @@ -139,7 +139,7 @@ BASE_REMOTE=$(get_remote_name 'wordpress-mobile/gutenberg-mobile') execute "git" "push" "-u" "$BASE_REMOTE" "HEAD" # Create Draft GB-Mobile Release PR in GitHub -GB_MOBILE_PR_URL=$("gh" "pr" "create" "--title" "Release $VERSION_NUMBER" "--body" "$PR_BODY" "--base" "main" "--label" "release-process" "--draft") +GB_MOBILE_PR_URL=$(execute "gh" "pr" "create" "--title" "Release $VERSION_NUMBER" "--body" "$PR_BODY" "--base" "main" "--label" "release-process" "--draft") ##### # Gutenberg PR @@ -167,7 +167,7 @@ GB_BASE_REMOTE=$(get_remote_name 'WordPress/gutenberg') execute "git" "push" "-u" "$GB_BASE_REMOTE" "HEAD" # Create Draft Gutenberg Release PR in GitHub -GUTENBERG_PR_URL=$("gh" "pr" "create" "--title" "Mobile Release v$VERSION_NUMBER" "--body" "$GUTENBERG_PR_BODY" "--base" "master" "--label" "Mobile App Android/iOS" "--draft") +GUTENBERG_PR_URL=$(execute "gh" "pr" "create" "--title" "Mobile Release v$VERSION_NUMBER" "--body" "$GUTENBERG_PR_BODY" "--base" "master" "--label" "Mobile App Android/iOS" "--draft") cd .. echo "PRs Created" From 2290c15b82ed357eac9957eb111ab247b8496539 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Mon, 17 Aug 2020 18:39:49 +0200 Subject: [PATCH 5/9] Remove json from package.json --- package-lock.json | 14 ++++---------- package.json | 1 - 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 51404b8b41..6cf2706ec8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2885,9 +2885,9 @@ "requires": { "@babel/runtime": "^7.9.2", "@wordpress/escape-html": "file:gutenberg/packages/escape-html", - "lodash": "^4.17.15", - "react": "^16.9.0", - "react-dom": "^16.9.0" + "lodash": "^4.17.19", + "react": "^16.13.1", + "react-dom": "^16.13.1" } }, "@wordpress/escape-html": { @@ -2952,7 +2952,7 @@ "requires": { "@babel/runtime": "^7.9.2", "jest-matcher-utils": "^25.3.0", - "lodash": "^4.17.15" + "lodash": "^4.17.19" } }, "@wordpress/jest-preset-default": { @@ -14982,12 +14982,6 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "json": { - "version": "9.0.6", - "resolved": "https://registry.npmjs.org/json/-/json-9.0.6.tgz", - "integrity": "sha1-eXLCpaSKQmeNsnMMfCxO5uTiRYU=", - "dev": true - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", diff --git a/package.json b/package.json index 0f79a7b481..83d8ccca76 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "identity-obj-proxy": "^3.0.0", "jest": "^24.9.0", "jest-junit": "^6.3.0", - "json": "^9.0.6", "metro-react-native-babel-preset": "^0.57.0", "node-fetch": "^2.3.0", "patch-package": "^6.2.2", From b11716773f0d380d95b1f905674afe77b9fa2793 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Mon, 17 Aug 2020 18:44:40 +0200 Subject: [PATCH 6/9] Check if jq is installed before executing script --- bin/release_automation.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/release_automation.sh b/bin/release_automation.sh index 8c65ec4ad4..9d60db3438 100755 --- a/bin/release_automation.sh +++ b/bin/release_automation.sh @@ -16,6 +16,9 @@ source bin/release_utils.sh # Check that Github CLI is installed command -v gh >/dev/null || abort "Error: The Github CLI must be installed." +# Check that jq is installed +command -v jq >/dev/null || abort "Error: jq must be installed." + # Check that Aztec versions are set to release versions aztec_version_problems="$(check_android_and_ios_aztec_versions)" if [[ ! -z "$aztec_version_problems" ]]; then From e6c6ae4ee117dd64eec6cc91eeeafb444bb1ccaf Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Mon, 17 Aug 2020 18:54:51 +0200 Subject: [PATCH 7/9] Fix warn utility function --- bin/release_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release_utils.sh b/bin/release_utils.sh index ecce05a3b6..9f7e9c784b 100644 --- a/bin/release_utils.sh +++ b/bin/release_utils.sh @@ -37,7 +37,7 @@ ohai() { } warn() { - printf "${tty_red}Warning${tty_reset}: %s\n" + printf "${tty_red}Warning${tty_reset}: %s\n" "$1" } abort() { From 21b01377c68f8c88d1abceebc075374542f01f06 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Mon, 17 Aug 2020 19:44:16 +0200 Subject: [PATCH 8/9] Add docs to utility functions --- bin/release_utils.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/release_utils.sh b/bin/release_utils.sh index 9f7e9c784b..7609e2893d 100644 --- a/bin/release_utils.sh +++ b/bin/release_utils.sh @@ -9,6 +9,7 @@ function get_remote_name() { # Utils adapted from https://github.com/Homebrew/install/blob/master/install.sh +# string formatters if [[ -t 1 ]]; then tty_escape() { printf "\033[%sm" "$1"; } else @@ -22,6 +23,8 @@ tty_bold="$(tty_mkbold 39)" tty_reset="$(tty_escape 0)" +# Takes multiple arguments and prints them joined with single spaces in-between +# while escaping any spaces in arguments themselves shell_join() { local arg printf "%s" "$1" @@ -32,19 +35,27 @@ shell_join() { done } +# Takes multiple arguments, joins them and prints them in a colored format ohai() { printf "${tty_blue}==> %s${tty_reset}\n" "$(shell_join "$@")" } +# Takes a single argument and prints it in a colored format warn() { - printf "${tty_red}Warning${tty_reset}: %s\n" "$1" + printf "${tty_underline}${tty_red}Warning${tty_reset}: %s\n" "$1" } +# Takes a single argument, prints it in a colored format and aborts the script abort() { printf "\n${tty_red}%s${tty_reset}\n" "$1" exit 1 } +# Takes multiple arguments consisting a command and executes it. If the command +# is not successful aborts the script, printing the failed command and its +# arguments in a colored format. +# +# Returns the executed command's result if it's successful. execute() { if ! "$@"; then abort "$(printf "Failed during: %s" "$(shell_join "$@")")" From ab2ddeddb9290516567d5b5f064dfc97e469e024 Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Mon, 17 Aug 2020 19:49:02 -0700 Subject: [PATCH 9/9] Add missing eslint-plugin-jsdoc --- package-lock.json | 50 +++++++++++++++++++++++++++++++++++++---------- package.json | 3 ++- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4a4fd9c6a8..7375085744 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10706,6 +10706,11 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "comment-parser": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.6.tgz", + "integrity": "sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg==" + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -11101,7 +11106,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, "requires": { "ms": "^2.1.1" } @@ -12066,6 +12070,32 @@ "@typescript-eslint/experimental-utils": "^2.5.0" } }, + "eslint-plugin-jsdoc": { + "version": "30.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.2.4.tgz", + "integrity": "sha512-7TLp+1EK/ufnzlBUuzgDiPz5k2UUIa01cFkZTvvbJr8PE0iWVDqENg0yLhqGUYaZfYRFhHpqCML8SQR94omfrg==", + "requires": { + "comment-parser": "^0.7.6", + "debug": "^4.1.1", + "jsdoctypeparser": "^9.0.0", + "lodash": "^4.17.20", + "regextras": "^0.7.1", + "semver": "^7.3.2", + "spdx-expression-parse": "^3.0.1" + }, + "dependencies": { + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + } + } + }, "eslint-plugin-jsx-a11y": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz", @@ -14939,6 +14969,11 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true }, + "jsdoctypeparser": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz", + "integrity": "sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==" + }, "jsdom": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", @@ -16368,8 +16403,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "mute-stream": { "version": "0.0.7", @@ -17532,8 +17566,7 @@ "regextras": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.7.1.tgz", - "integrity": "sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w==", - "dev": true + "integrity": "sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w==" }, "regjsgen": { "version": "0.5.1", @@ -18317,14 +18350,12 @@ "spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" }, "spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -18333,8 +18364,7 @@ "spdx-license-ids": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", - "dev": true + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" }, "split-string": { "version": "3.1.0", diff --git a/package.json b/package.json index feddd9f39d..4fe37c12be 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "version": "npm run bundle && git add -A bundle" }, "dependencies": { - "email-validator": "2.0.4" + "email-validator": "2.0.4", + "eslint-plugin-jsdoc": "^30.2.4" } }