aboutsummaryrefslogtreecommitdiffstats
path: root/development
diff options
context:
space:
mode:
Diffstat (limited to 'development')
-rwxr-xr-xdevelopment/auto-changelog.sh26
-rwxr-xr-xdevelopment/rollback.sh35
2 files changed, 61 insertions, 0 deletions
diff --git a/development/auto-changelog.sh b/development/auto-changelog.sh
new file mode 100755
index 000000000..f9f577ade
--- /dev/null
+++ b/development/auto-changelog.sh
@@ -0,0 +1,26 @@
+#! /bin/bash
+# update tags
+git fetch --tags
+# get origin
+URL='https://github.com/MetaMask/metamask-extension'
+# get git logs from last tag until HEAD, pretty by 'subject::body' filtered by grep for PRs made with Github squash merge or Github regular merge
+LOG=$(git log $(git describe --tags $(git rev-list --tags --max-count=1))..HEAD --pretty="%s::%b" --reverse --grep="Merge pull request #" --grep="(#");
+while read -r line; do
+ # get git log subject
+ SUBJECT=$(echo $line | sed -E 's/(.*):{2}(.*)/\1/')
+ # get git log PR id, PR made with Github squash merge or Github regular merge
+ PR=$(echo $SUBJECT | sed 's/^.*(#\([^&]*\)).*/\1/' | sed 's/^.*#\([^&]*\) from.*/\1/')
+ # if PR made with Github squash merge, subject is the body
+ if [ -z "$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')" ]; then
+ BODY=$(echo $SUBJECT | sed "s/(#$PR)//g"); else
+ BODY=$(echo $line | sed -E 's/(.*):{2}(.*)/\2/')
+ fi
+ # add entry to CHANGELOG
+ if [[ "$OSTYPE" == "linux-gnu" ]]; then
+ sed -i'' '/## Current Develop Branch/a\
+- [#'"$PR"']('"$URL"'/pull/'"$PR"'): '"$BODY"''$'\n' CHANGELOG.md; else
+ sed -i '' '/## Current Develop Branch/a\
+- [#'"$PR"']('"$URL"'/pull/'"$PR"'): '"$BODY"''$'\n' CHANGELOG.md;
+ fi
+done <<< "$LOG"
+echo 'CHANGELOG updated'
diff --git a/development/rollback.sh b/development/rollback.sh
new file mode 100755
index 000000000..0a1d8ad62
--- /dev/null
+++ b/development/rollback.sh
@@ -0,0 +1,35 @@
+#! /bin/bash
+
+[[ -z "$1" ]] && { echo "Rollback version is required!" ; exit 1; }
+echo "Rolling back to version $1"
+
+# Checkout branch to increment version
+git checkout -b version-increment-$1
+npm run version:bump patch
+
+# Store the new version name
+NEW_VERSION=$(cat app/manifest.json | jq -r .version)
+
+# Make sure origin tags are loaded
+git fetch origin
+
+# check out the rollback branch
+git checkout origin/v$1
+
+# Create the rollback branch.
+git checkout -b Version-$NEW_VERSION-Rollback-to-$1
+
+# Set the version files to the next one.
+git checkout master CHANGELOG.md
+git checkout master app/manifest.json
+git commit -m "Version $NEW_VERSION (Rollback to $1)"
+
+# Push the new branch to PR
+git push -u origin HEAD
+
+# Create tag and push that up too
+git tag v${NEW_VERSION}
+git push origin v${NEW_VERSION}
+
+# Cleanup version branch
+git branch -D version-increment-$1