ci: hide encryption key from circleci logs (#23585)

PR Close #23585
This commit is contained in:
Alex Eagle
2018-04-27 16:21:38 -07:00
committed by Igor Minar
parent d7ed9c9e9e
commit b45fa5e263
4 changed files with 39 additions and 18 deletions

View File

@ -64,7 +64,7 @@ function publishRepo {
BUILD_VER="${LATEST_TAG}+${SHORT_SHA}"
if [[ ${CI} ]]; then
(
# The file ~/.git_credentials is created below
# The file ~/.git_credentials is created in /.circleci/config.yml
cd $REPO_DIR && \
git config credential.helper "store --file=$HOME/.git_credentials"
)
@ -122,19 +122,7 @@ CUR_BRANCH=${CIRCLE_BRANCH:-$(git symbolic-ref --short HEAD)}
if [ $# -gt 0 ]; then
ORG=$1
publishPackages "ssh" dist/packages-dist $CUR_BRANCH
elif [[ \
"$CIRCLE_PROJECT_USERNAME" == "angular" && \
"$CIRCLE_PROJECT_REPONAME" == "angular" && \
! -v CIRCLE_PR_NUMBER ]]; then
ORG="angular"
# $KEY is set on CI only for non-PR builds. See /.circleci/README.md
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out "${HOME}/.git_credentials"
publishPackages "http" dist/packages-dist $CUR_BRANCH
# Clean up the credentials file out of caution
rm "${HOME}/.git_credentials"
else
echo "Not building the upstream/${CUR_BRANCH} branch, build artifacts won't be published."
ORG="angular"
publishPackages "http" dist/packages-dist $CUR_BRANCH
fi