diff --git a/.circleci/config.yml b/.circleci/config.yml index 51721c7f5cda..4d0d404bf7fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -123,12 +123,18 @@ jobs: - checkout - attach_workspace: at: . + - run: + name: Bump manifest version + command: .circleci/scripts/release-bump-manifest-version.sh + - run: + name: Update changelog + command: yarn update-changelog + - run: + name: Commit changes + command: .circleci/scripts/release-commit-version-bump.sh - run: name: Create GitHub Pull Request for version - command: | - .circleci/scripts/release-bump-changelog-version.sh - .circleci/scripts/release-bump-manifest-version.sh - .circleci/scripts/release-create-release-pr.sh + command: .circleci/scripts/release-create-release-pr.sh prep-deps: executor: node-browsers diff --git a/.circleci/scripts/release-bump-manifest-version.sh b/.circleci/scripts/release-bump-manifest-version.sh index 78686d250d86..776a33a63477 100755 --- a/.circleci/scripts/release-bump-manifest-version.sh +++ b/.circleci/scripts/release-bump-manifest-version.sh @@ -26,14 +26,4 @@ yarn prettier --write app/manifest/_base.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/_base.json - -repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" -git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" "$CIRCLE_BRANCH" diff --git a/.circleci/scripts/release-commit-version-bump.sh b/.circleci/scripts/release-commit-version-bump.sh new file mode 100755 index 000000000000..6ceb67fb9f62 --- /dev/null +++ b/.circleci/scripts/release-commit-version-bump.sh @@ -0,0 +1,34 @@ +#!/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' 'Commit the manifest version and changelog if the manifest has changed' + +if git diff --quiet app/manifest/_base.json; +then + printf '%s\n' 'No manifest changes to commit' + 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/_base.json + +repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" +git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" "$CIRCLE_BRANCH"