diff --git a/auto-changelog.sh b/development/auto-changelog.sh similarity index 100% rename from auto-changelog.sh rename to development/auto-changelog.sh 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 diff --git a/docs/sensitive-release.md b/docs/sensitive-release.md index e2c4e2f3d..288df57eb 100644 --- a/docs/sensitive-release.md +++ b/docs/sensitive-release.md @@ -18,10 +18,10 @@ Simply follow the steps in [the publishing guide](./publishing.md). ### Prepare Rollback Release -1. Check out the tagged commit for the release before this new release. -2. Increment the version over the new release by one patch. -3. Merge the changelog of the new release into this branch, and make its own changelog refer to rolling back those changes. -4. Push to the main repository and pull request against `master` prominently noting this is a `DO NOT MERGE` rollback pull request. +1. Be on the new risky version branch. +2. Run `npm run rollback $ROLLBACK_TARGET_VERSION`. + +The rollback version will now be a branch and tag on the origin. ### Roll the normal release out diff --git a/package.json b/package.json index 2b288d2ba..8f31c1d22 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "announce": "node development/announcer.js", "version:bump": "node development/run-version-bump.js", "storybook": "start-storybook -p 6006 -c .storybook", - "update-changelog": "./auto-changelog.sh" + "update-changelog": "./development/auto-changelog.sh", + "rollback": "./development/rollback.sh" }, "browserify": { "transform": [