fix(build): Change publish-build-artifacts.sh to work with new packaging system
This commit is contained in:
parent
817ddfa847
commit
d414734aac
|
@ -3,13 +3,13 @@ set -e -x
|
||||||
|
|
||||||
|
|
||||||
function publishRepo {
|
function publishRepo {
|
||||||
LANG=$1
|
COMPONENT=$1
|
||||||
ARTIFACTS_DIR=$2
|
ARTIFACTS_DIR=$2
|
||||||
|
|
||||||
BUILD_BRANCH="builds-${LANG}"
|
BUILD_REPO="${COMPONENT}-builds"
|
||||||
REPO_DIR="tmp/${BUILD_BRANCH}"
|
REPO_DIR="tmp/${BUILD_REPO}"
|
||||||
|
|
||||||
echo "Pushing build artifacts to angular/$BUILD_BRANCH"
|
echo "Pushing build artifacts to angular/${BUILD_REPO}"
|
||||||
|
|
||||||
# create local repo folder and clone build repo into it
|
# create local repo folder and clone build repo into it
|
||||||
rm -rf $REPO_DIR
|
rm -rf $REPO_DIR
|
||||||
|
@ -18,15 +18,20 @@ function publishRepo {
|
||||||
cd $REPO_DIR && \
|
cd $REPO_DIR && \
|
||||||
git init && \
|
git init && \
|
||||||
git remote add origin $REPO_URL && \
|
git remote add origin $REPO_URL && \
|
||||||
git fetch origin $BUILD_BRANCH && \
|
git fetch origin master && \
|
||||||
git checkout origin/$BUILD_BRANCH && \
|
git checkout origin/master && \
|
||||||
git checkout -b $BUILD_BRANCH
|
git checkout -b master
|
||||||
)
|
)
|
||||||
|
|
||||||
# copy over build artifacts into the repo directory
|
# copy over build artifacts into the repo directory
|
||||||
rm -rf $REPO_DIR/*
|
rm -rf $REPO_DIR/*
|
||||||
cp -R $ARTIFACTS_DIR/* $REPO_DIR/
|
cp -R $ARTIFACTS_DIR/* $REPO_DIR/
|
||||||
grep -v /typings/ .gitignore > $REPO_DIR/.gitignore
|
grep -v /typings/ .gitignore > $REPO_DIR/.gitignore
|
||||||
|
|
||||||
|
# Replace $$ANGULAR_VESION$$ with the build version.
|
||||||
|
BUILD_VER="2.0.0-${SHORT_SHA}"
|
||||||
|
find $REPO_DIR/ -type f -name package.json -print0 | xargs -0 sed -i '' "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g"
|
||||||
|
find $REPO_DIR/ -type f -name "*umd.js" -print0 | xargs -0 sed -i '' "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g"
|
||||||
echo `date` > $REPO_DIR/BUILD_INFO
|
echo `date` > $REPO_DIR/BUILD_INFO
|
||||||
echo $SHA >> $REPO_DIR/BUILD_INFO
|
echo $SHA >> $REPO_DIR/BUILD_INFO
|
||||||
|
|
||||||
|
@ -38,40 +43,38 @@ function publishRepo {
|
||||||
git config user.email "${COMMITTER_USER_EMAIL}" && \
|
git config user.email "${COMMITTER_USER_EMAIL}" && \
|
||||||
git add --all && \
|
git add --all && \
|
||||||
git commit -m "${COMMIT_MSG}" && \
|
git commit -m "${COMMIT_MSG}" && \
|
||||||
git push origin $BUILD_BRANCH && \
|
git push origin master && \
|
||||||
git tag "2.0.0-build.${SHORT_SHA}.${LANG}" && \
|
git tag "${BUILD_VER}" && \
|
||||||
git push origin --tags
|
git push origin --tags
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Publish all individual packages from packages-dist.
|
||||||
if [[ "$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
if [[ "$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
||||||
"$TRAVIS_PULL_REQUEST" == "false" && \
|
"$TRAVIS_PULL_REQUEST" == "false" && \
|
||||||
"$MODE" == "build_only" ]]; then
|
"$CI_MODE" == "e2e" ]]; then
|
||||||
|
for dir in dist/packages-dist/*/
|
||||||
|
do
|
||||||
|
COMPONENT="$(basename ${dir})"
|
||||||
|
|
||||||
DART_BUILD_ARTIFACTS_DIR="dist/pub/angular2"
|
# Replace _ with - in component name.
|
||||||
JS_BUILD_ARTIFACTS_DIR="dist/npm/angular2"
|
COMPONENT="${COMPONENT//_/-}"
|
||||||
|
JS_BUILD_ARTIFACTS_DIR="${dir}"
|
||||||
|
|
||||||
DART_BUILD_BRANCH="builds-dart"
|
REPO_URL="https://github.com/angular/${COMPONENT}-builds.git"
|
||||||
JS_BUILD_BRANCH="builds-js"
|
# Use the below URL for testing when using SSH authentication
|
||||||
|
# REPO_URL="git@github.com:angular/${COMPONENT}-builds.git"
|
||||||
|
|
||||||
REPO_URL="https://github.com/angular/angular.git"
|
SHA=`git rev-parse HEAD`
|
||||||
# Use the below URL for testing when using SSH authentication
|
SHORT_SHA=`git rev-parse --short HEAD`
|
||||||
# REPO_URL="git@github.com:angular/angular.git"
|
COMMIT_MSG=`git log --oneline | head -n1`
|
||||||
|
COMMITTER_USER_NAME=`git --no-pager show -s --format='%cN' HEAD`
|
||||||
|
COMMITTER_USER_EMAIL=`git --no-pager show -s --format='%cE' HEAD`
|
||||||
|
|
||||||
SHA=`git rev-parse HEAD`
|
publishRepo "${COMPONENT}" "${JS_BUILD_ARTIFACTS_DIR}"
|
||||||
SHORT_SHA=`git rev-parse --short HEAD`
|
done
|
||||||
COMMIT_MSG=`git log --oneline | head -n1`
|
|
||||||
COMMITTER_USER_NAME=`git --no-pager show -s --format='%cN' HEAD`
|
|
||||||
COMMITTER_USER_EMAIL=`git --no-pager show -s --format='%cE' HEAD`
|
|
||||||
|
|
||||||
scripts/publish/npm_prepare.sh angular2
|
|
||||||
publishRepo "js" "${JS_BUILD_ARTIFACTS_DIR}"
|
|
||||||
|
|
||||||
scripts/publish/pub_prepare.sh angular2
|
|
||||||
publishRepo "dart" "${DART_BUILD_ARTIFACTS_DIR}"
|
|
||||||
echo "Finished publishing build artifacts"
|
echo "Finished publishing build artifacts"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Not building the upstream/master branch, build artifacts won't be published."
|
echo "Not building the upstream/master branch, build artifacts won't be published."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue