From b2259b88bc58bd891e80f7632f379f8873165ec7 Mon Sep 17 00:00:00 2001 From: jake-perkins <128608287+jake-perkins@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:57:33 -0600 Subject: [PATCH] chore: fix release pr fixes (#12192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR is an attempt to resolve deficiencies with the "Create Release Pull Request" shared workflow. Currently it is not correctly provisioning the release branch before creating a PR which is causing the script to fail. ## **Related issues** Fixes: Execution bug ## **Manual testing steps** Unfortunately this cannot be tested outside of the main branch CI, however we have a high confidence of this fix as a previous version of this workflow used to do this step so we are reintroducing the logic ## **Screenshots/Recordings** N/A - CICD Only ### **Before** N/A ### **After** N/A ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- scripts/create-release-pr.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/create-release-pr.sh b/scripts/create-release-pr.sh index 9b3d5c357dd..87bbfaa78a4 100755 --- a/scripts/create-release-pr.sh +++ b/scripts/create-release-pr.sh @@ -35,35 +35,50 @@ RELEASE_BODY="This is the release candidate for version ${NEW_VERSION}. The chan # Reference - Testing plan sheet - https://docs.google.com/spreadsheets/d/1tsoodlAlyvEUpkkcNcbZ4PM9HuC9cEM80RZeoVv5OCQ/edit?gid=404070372#gid=404070372" +echo "Configuring git.." git config user.name metamaskbot git config user.email metamaskbot@users.noreply.github.com +echo "Checking out ${RELEASE_BRANCH_NAME}" +git checkout "${RELEASE_BRANCH_NAME}" +echo "Release Branch Checked Out" + +echo "Running version update scripts.." # Bump versions for the release ./scripts/set-semvar-version.sh "${NEW_VERSION}" ./scripts/set-build-version.sh "${NEW_VERSION_NUMBER}" +echo "Adding and committing changes.." # Track our changes git add package.json android/app/build.gradle ios/MetaMask/Info.plist bitrise.yml +# Generate a commit git commit -m "bump semvar version to ${NEW_VERSION} && build version to ${NEW_VERSION_NUMBER}" +echo "Pushing changes to the remote.." +git push --set-upstream origin "${RELEASE_BRANCH_NAME}" + +echo Creating release PR.. + gh pr create \ --draft \ --title "feat: ${NEW_VERSION}" \ --body "${RELEASE_BODY}" \ --head "${RELEASE_BRANCH_NAME}"; + echo "Release PR Created" -git checkout "${RELEASE_BRANCH_NAME}" -echo "Release Branch Checked Out" +echo "Checking out ${CHANGELOG_BRANCH_NAME}" git checkout -b "${CHANGELOG_BRANCH_NAME}" echo "Changelog Branch Created" #Generate changelog and test plan csv +echo "Generating changelog and test plan csv.." node ./scripts/generate-rc-commits.mjs "${PREVIOUS_VERSION}" "${RELEASE_BRANCH_NAME}" ./scripts/changelog-csv.sh "${RELEASE_BRANCH_NAME}" +echo "Adding and committing changes.." git add ./commits.csv if ! (git commit -am "updated changelog and generated feature test plan"); @@ -74,11 +89,15 @@ fi PR_BODY="This PR updates the change log for ${NEW_VERSION} and generates the test plan here [commit.csv](https://github.com/MetaMask/metamask-mobile/blob/${RELEASE_BRANCH_NAME}/commits.csv)" +echo "Pushing changes to the remote.." git push --set-upstream origin "${CHANGELOG_BRANCH_NAME}" +echo Creating release PR.. gh pr create \ --draft \ --title "chore: ${CHANGELOG_BRANCH_NAME}" \ --body "${PR_BODY}" \ --base "${RELEASE_BRANCH_NAME}" \ - --head "${CHANGELOG_BRANCH_NAME}"; \ No newline at end of file + --head "${CHANGELOG_BRANCH_NAME}"; + +echo "Changelog PR Created" \ No newline at end of file