ci: publish build snapshots from Bazel/CircleCI (#23512)
This uses a new script and CircleCI job called "build-packages-dist" which shims the new Bazel build to produce outputs matching the legacy build. We'll use this to get AIO testing onto CircleCI as well. We move the integration tests to a new circleCI job that depends on this one, as well as the build publishing job. Note that every PR will have a trivial green publishing status, because we always create this job even for PRs. We'd rather not - see https://discuss.circleci.com/t/workflows-pull-request-filter/14396/4 PR Close #23512
This commit is contained in:

committed by
Victor Berchet

parent
60e5507076
commit
b26ac1c22f
@ -15,12 +15,7 @@ if [[ ${TRAVIS_TEST_RESULT=0} == 1 ]]; then
|
||||
fi
|
||||
|
||||
|
||||
# Don't deploy if not running against angular/angular
|
||||
# TODO(i): because we don't let deploy to run outside of angular/angular folks can't use their
|
||||
# private travis build to deploy anywhere. This is likely ok, but this means that @alexeagle's
|
||||
# fancy setup to publish ES2015 packages to github -build repos no longer works. This is ok
|
||||
# since with flat modules we'll have this feature built-in. We should still go and remove
|
||||
# stuff that Alex put in for this from publish-build-artifacts.sh
|
||||
# Don't deploy Angular.io if we are running in a fork
|
||||
if [[ ${TRAVIS_REPO_SLUG} != "angular/angular" ]]; then
|
||||
echo "Skipping deploy because this is not angular/angular."
|
||||
exit 0
|
||||
@ -28,19 +23,6 @@ fi
|
||||
|
||||
|
||||
case ${CI_MODE} in
|
||||
|
||||
e2e)
|
||||
# Don't deploy if this is a PR build
|
||||
if [[ ${TRAVIS_PULL_REQUEST} != "false" ]]; then
|
||||
echo "Skipping deploy because this is a PR build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
travisFoldStart "deploy.packages"
|
||||
${thisDir}/publish-build-artifacts.sh
|
||||
travisFoldEnd "deploy.packages"
|
||||
;;
|
||||
|
||||
aio)
|
||||
travisFoldStart "deploy.aio"
|
||||
(
|
||||
|
@ -4,8 +4,6 @@ set -x -u -e -o pipefail
|
||||
|
||||
# Setup environment
|
||||
readonly thisDir=$(cd $(dirname $0); pwd)
|
||||
source ${thisDir}/_travis-fold.sh
|
||||
|
||||
|
||||
# Find the most recent tag that is reachable from the current commit.
|
||||
# This is shallow clone of the repo, so we might need to fetch more commits to
|
||||
@ -63,22 +61,12 @@ function publishRepo {
|
||||
rm -rf $REPO_DIR/*
|
||||
cp -R $ARTIFACTS_DIR/* $REPO_DIR/
|
||||
|
||||
# Replace $$ANGULAR_VERSION$$ with the build version.
|
||||
BUILD_VER="${LATEST_TAG}+${SHORT_SHA}"
|
||||
if [[ ${TRAVIS} ]]; then
|
||||
find $REPO_DIR/ -type f -name package.json -print0 | xargs -0 sed -i "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g"
|
||||
|
||||
# Find umd.js and umd.min.js
|
||||
UMD_FILES=$(find $REPO_DIR/ -type f -name "*.umd*.js" -print)
|
||||
for UMD_FILE in ${UMD_FILES}; do
|
||||
sed -i "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g" ${UMD_FILE}
|
||||
done
|
||||
|
||||
if [[ ${CI} ]]; then
|
||||
(
|
||||
# The file ~/.git_credentials is created below
|
||||
cd $REPO_DIR && \
|
||||
git config credential.helper "store --file=.git/credentials" && \
|
||||
# SECURITY CRITICAL: DO NOT use shell to expand vars since it could be logged and leaked.
|
||||
node -e "console.log('https://'+process.env.GITHUB_TOKEN_ANGULAR+':@github.com')" > .git/credentials
|
||||
git config credential.helper "store --file=$HOME/.git_credentials"
|
||||
)
|
||||
fi
|
||||
echo `date` > $REPO_DIR/BUILD_INFO
|
||||
@ -130,23 +118,22 @@ function publishPackages {
|
||||
}
|
||||
|
||||
# See docs/DEVELOPER.md for help
|
||||
CUR_BRANCH=${TRAVIS_BRANCH:-$(git symbolic-ref --short HEAD)}
|
||||
CUR_BRANCH=${CIRCLE_BRANCH:-$(git symbolic-ref --short HEAD)}
|
||||
if [ $# -gt 0 ]; then
|
||||
ORG=$1
|
||||
publishPackages "ssh" dist/packages-dist $CUR_BRANCH
|
||||
if [[ -e dist/packages-dist-es2015 ]]; then
|
||||
publishPackages "ssh" dist/packages-dist-es2015 ${CUR_BRANCH}-es2015
|
||||
fi
|
||||
|
||||
elif [[ \
|
||||
"$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
||||
"$TRAVIS_PULL_REQUEST" == "false" && \
|
||||
"$CI_MODE" == "e2e" ]]; then
|
||||
"$CIRCLE_PROJECT_USERNAME" == "angular" && \
|
||||
"$CIRCLE_PROJECT_REPONAME" == "angular" && \
|
||||
! -v CIRCLE_PULL_REQUEST ]]; 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
|
||||
if [[ -e dist/packages-dist-es2015 ]]; then
|
||||
publishPackages "http" dist/packages-dist-es2015 ${CUR_BRANCH}-es2015
|
||||
fi
|
||||
# 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."
|
||||
|
Reference in New Issue
Block a user