Skip to content

Commit

Permalink
chore: cicd error handling (#12194)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
Resolves all bugs with create-release-pr.sh shell script

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Related issues**

Fixes:
Git branch management issues when creating/pushing to origin

## **Manual testing steps**

Manually tested using workflow invocation from feature branch
https://github.com/MetaMask/metamask-mobile/actions/runs/11693971837

Produced the following PRs
#12195 ( Release )
#12196 ( Changelog )

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->
N/A

### **After**

<!-- [screenshots/recordings] -->
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**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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.
  • Loading branch information
jake-perkins authored Nov 6, 2024
1 parent af62e1b commit 9f29292
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ jobs:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_BRANCH: ${{ github.event.inputs.base-branch }}
run: |
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }} ${{ needs.generate-build-version.outputs.build-version }}
16 changes: 13 additions & 3 deletions scripts/create-release-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ 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 "Fetching from remote..."
git fetch

# Check if the release branch already exists on the remote
if git branch -a | grep -q "remotes/origin/${RELEASE_BRANCH_NAME}"; then
echo "Release branch exists on remote, checking out."
git checkout "${RELEASE_BRANCH_NAME}"
else
echo "Release branch does not exist on remote, creating from ${BASE_BRANCH}."
git checkout -b "${RELEASE_BRANCH_NAME}"
fi

echo "Release Branch Checked Out"

echo "Running version update scripts.."
Expand All @@ -50,7 +60,7 @@ echo "Running version update scripts.."

echo "Adding and committing changes.."
# Track our changes
git add package.json android/app/build.gradle ios/MetaMask/Info.plist bitrise.yml
git add package.json android/app/build.gradle ios/MetaMask.xcodeproj/project.pbxproj bitrise.yml

# Generate a commit
git commit -m "bump semvar version to ${NEW_VERSION} && build version to ${NEW_VERSION_NUMBER}"
Expand Down

0 comments on commit 9f29292

Please sign in to comment.