From 7d4577f25befdc9b10c12981759d526df8098bcd Mon Sep 17 00:00:00 2001 From: sethkfman <10342624+sethkfman@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:20:21 -0600 Subject: [PATCH] chore: update release action to not create the release branch but just open PR (#11842) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR makes a minor change to make the release action depend on an existing release branch before running the action. The new action will create a PR for the release branch and creating a PR for the changelog and version bump against the release branch. ## **Related issues** Fixes: ## **Manual testing steps** 1. Confirm there is a release branch 2. Run the GH action 3. See successful run and 2 PRs ## **Screenshots/Recordings** ### **Before** NA ### **After** - Example PR: https://github.com/MetaMask/metamask-mobile/pull/11887 - Example Changelog PR: https://github.com/MetaMask/metamask-mobile/pull/11888 - Successful Action Run: https://github.com/MetaMask/metamask-mobile/actions/runs/11411806607 ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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. --- .github/workflows/create-release-pr.yml | 10 +++---- scripts/create-release-pr.sh | 36 +++++++++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 58c8c4152d2..6065f84b868 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -43,14 +43,10 @@ jobs: cache: yarn - name: Install dependencies run: yarn --immutable - - name: Set Versions - id: set-versions - shell: bash - run: SEMVER_VERSION=${{ github.event.inputs.semver-version }} VERSION_NUMBER=${{ github.event.inputs.version-number }} yarn set-version - - name: Create Release PR - id: create-release-pr + - name: Create Release & Changelog PR + id: create-release-changelog-pr shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }} \ No newline at end of file + ./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }} ${{ github.event.inputs.version-number }} \ No newline at end of file diff --git a/scripts/create-release-pr.sh b/scripts/create-release-pr.sh index 543360ce7d8..82ea4deb6a0 100755 --- a/scripts/create-release-pr.sh +++ b/scripts/create-release-pr.sh @@ -6,6 +6,7 @@ set -o pipefail PREVIOUS_VERSION="${1}" NEW_VERSION="${2}" +NEW_VERSION_NUMBER="${3}" RELEASE_BRANCH_PREFIX="release/" if [[ -z $NEW_VERSION ]]; then @@ -15,30 +16,43 @@ fi RELEASE_BRANCH_NAME="${RELEASE_BRANCH_PREFIX}${NEW_VERSION}" CHANGELOG_BRANCH_NAME="chore/${NEW_VERSION}-Changelog" -RELEASE_BODY="This is the release candidate for version ${NEW_VERSION}. The changelog will be found in another PR ${CHANGELOG_BRANCH_NAME}." +RELEASE_BODY="This is the release candidate for version ${NEW_VERSION}. The changelog will be found in another PR ${CHANGELOG_BRANCH_NAME}. + + # Team sign-off checklist + - [ ] team-accounts + - [ ] team-assets + - [ ] team-confirmations + - [ ] team-design-system + - [ ] team-notifications + - [ ] team-platform + - [ ] team-security + - [ ] team-snaps-platform + - [ ] team-sdk + - [ ] team-stake + - [ ] team-tiger + - [ ] team-wallet-framework + + # Reference + - Testing plan sheet - https://docs.google.com/spreadsheets/d/1tsoodlAlyvEUpkkcNcbZ4PM9HuC9cEM80RZeoVv5OCQ/edit?gid=404070372#gid=404070372" git config user.name metamaskbot git config user.email metamaskbot@users.noreply.github.com -git checkout -b "${RELEASE_BRANCH_NAME}" - -if ! (git add . && git commit -m "${NEW_VERSION}"); -then - echo "Error: No changes detected." - exit 1 -fi - -git push --set-upstream origin "${RELEASE_BRANCH_NAME}" - 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" git checkout -b "${CHANGELOG_BRANCH_NAME}" +echo "Changelog Branch Created" +#Bump versions for the release" +SEMVER_VERSION="${NEW_VERSION}" VERSION_NUMBER="${NEW_VERSION_NUMBER}" yarn set-version #Generate changelog and test plan csv node ./scripts/generate-rc-commits.mjs "${PREVIOUS_VERSION}" "${RELEASE_BRANCH_NAME}"