2021-04-02 23:11:51 +02:00
|
|
|
#!/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
|
|
|
|
|
2021-05-03 16:24:39 +02:00
|
|
|
if [[ -z "${GITHUB_TOKEN:-}" ]]
|
|
|
|
then
|
|
|
|
printf '%s\n' 'GITHUB_TOKEN environment variable must be set'
|
|
|
|
exit 1
|
|
|
|
elif [[ -z "${GITHUB_TOKEN_USER:-}" ]]
|
|
|
|
then
|
|
|
|
printf '%s\n' 'GITHUB_TOKEN_USER environment variable must be set'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-04-02 23:11:51 +02:00
|
|
|
printf '%s\n' 'Commit the manifest version and changelog if the manifest has changed'
|
|
|
|
|
2021-05-10 23:16:03 +02:00
|
|
|
if git diff --quiet package.json;
|
2021-04-02 23:11:51 +02:00
|
|
|
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/-/ }" \
|
2021-05-10 23:16:03 +02:00
|
|
|
CHANGELOG.md package.json
|
2021-04-02 23:11:51 +02:00
|
|
|
|
|
|
|
repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
|
|
|
|
git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" "$CIRCLE_BRANCH"
|