diff options
Diffstat (limited to '.circleci/scripts/release-bump-manifest-version')
-rwxr-xr-x | .circleci/scripts/release-bump-manifest-version | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/.circleci/scripts/release-bump-manifest-version b/.circleci/scripts/release-bump-manifest-version new file mode 100755 index 000000000..44b193c97 --- /dev/null +++ b/.circleci/scripts/release-bump-manifest-version @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +if [[ "${CI:-}" != 'true' ]] +then + printf '%s\n' 'CI environment variable must be set to true' + exit 1 +fi + +if [[ "${CIRCLECI:-}" != 'true' ]] +then + printf '%s\n' 'CIRCLECI environment variable must be set to true' + exit 1 +fi + +printf '%s\n' 'Updating the manifest version if needed' + +version="${CIRCLE_BRANCH/Version-v/}" +updated_manifest="$(jq ".version = \"$version\"" app/manifest.json)" +printf '%s\n' "$updated_manifest" > app/manifest.json + +if [[ -z $(git status --porcelain) ]] +then + printf '%s\n' 'App manifest version already set' + exit 0 +fi + +git \ + -c user.name='MetaMask Bot' \ + -c user.email='metamaskbot@users.noreply.github.com' \ + commit --message "${CIRCLE_BRANCH/-/ }" \ + CHANGELOG.md app/manifest.json + +repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" +git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" "$CIRCLE_BRANCH" |