Skip to content

Commit d414734

Browse files
committed
fix(build): Change publish-build-artifacts.sh to work with new packaging system
1 parent 817ddfa commit d414734

1 file changed

Lines changed: 32 additions & 29 deletions

File tree

‎scripts/publish/publish-build-artifacts.sh‎

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ set -e -x
33

44

55
function publishRepo {
6-
LANG=$1
6+
COMPONENT=$1
77
ARTIFACTS_DIR=$2
88

9-
BUILD_BRANCH="builds-${LANG}"
10-
REPO_DIR="tmp/${BUILD_BRANCH}"
9+
BUILD_REPO="${COMPONENT}-builds"
10+
REPO_DIR="tmp/${BUILD_REPO}"
1111

12-
echo "Pushing build artifacts to angular/$BUILD_BRANCH"
12+
echo "Pushing build artifacts to angular/${BUILD_REPO}"
1313

1414
# create local repo folder and clone build repo into it
1515
rm -rf $REPO_DIR
@@ -18,15 +18,20 @@ function publishRepo {
1818
cd $REPO_DIR && \
1919
git init && \
2020
git remote add origin $REPO_URL && \
21-
git fetch origin $BUILD_BRANCH && \
22-
git checkout origin/$BUILD_BRANCH && \
23-
git checkout -b $BUILD_BRANCH
21+
git fetch origin master && \
22+
git checkout origin/master && \
23+
git checkout -b master
2424
)
2525

2626
# copy over build artifacts into the repo directory
2727
rm -rf $REPO_DIR/*
2828
cp -R $ARTIFACTS_DIR/* $REPO_DIR/
2929
grep -v /typings/ .gitignore > $REPO_DIR/.gitignore
30+
31+
# Replace $$ANGULAR_VESION$$ with the build version.
32+
BUILD_VER="2.0.0-${SHORT_SHA}"
33+
find $REPO_DIR/ -type f -name package.json -print0 | xargs -0 sed -i '' "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g"
34+
find $REPO_DIR/ -type f -name "*umd.js" -print0 | xargs -0 sed -i '' "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g"
3035
echo `date` > $REPO_DIR/BUILD_INFO
3136
echo $SHA >> $REPO_DIR/BUILD_INFO
3237

@@ -38,40 +43,38 @@ function publishRepo {
3843
git config user.email "${COMMITTER_USER_EMAIL}" && \
3944
git add --all && \
4045
git commit -m "${COMMIT_MSG}" && \
41-
git push origin $BUILD_BRANCH && \
42-
git tag "2.0.0-build.${SHORT_SHA}.${LANG}" && \
46+
git push origin master && \
47+
git tag "${BUILD_VER}" && \
4348
git push origin --tags
4449
)
4550
}
4651

47-
52+
# Publish all individual packages from packages-dist.
4853
if [[ "$TRAVIS_REPO_SLUG" == "angular/angular" && \
4954
"$TRAVIS_PULL_REQUEST" == "false" && \
50-
"$MODE" == "build_only" ]]; then
51-
52-
DART_BUILD_ARTIFACTS_DIR="dist/pub/angular2"
53-
JS_BUILD_ARTIFACTS_DIR="dist/npm/angular2"
55+
"$CI_MODE" == "e2e" ]]; then
56+
for dir in dist/packages-dist/*/
57+
do
58+
COMPONENT="$(basename ${dir})"
5459

55-
DART_BUILD_BRANCH="builds-dart"
56-
JS_BUILD_BRANCH="builds-js"
60+
# Replace _ with - in component name.
61+
COMPONENT="${COMPONENT//_/-}"
62+
JS_BUILD_ARTIFACTS_DIR="${dir}"
5763

58-
REPO_URL="https://github.com/angular/angular.git"
59-
# Use the below URL for testing when using SSH authentication
60-
# REPO_URL="git@github.com:angular/angular.git"
64+
REPO_URL="https://github.com/angular/${COMPONENT}-builds.git"
65+
# Use the below URL for testing when using SSH authentication
66+
# REPO_URL="git@github.com:angular/${COMPONENT}-builds.git"
6167

62-
SHA=`git rev-parse HEAD`
63-
SHORT_SHA=`git rev-parse --short HEAD`
64-
COMMIT_MSG=`git log --oneline | head -n1`
65-
COMMITTER_USER_NAME=`git --no-pager show -s --format='%cN' HEAD`
66-
COMMITTER_USER_EMAIL=`git --no-pager show -s --format='%cE' HEAD`
68+
SHA=`git rev-parse HEAD`
69+
SHORT_SHA=`git rev-parse --short HEAD`
70+
COMMIT_MSG=`git log --oneline | head -n1`
71+
COMMITTER_USER_NAME=`git --no-pager show -s --format='%cN' HEAD`
72+
COMMITTER_USER_EMAIL=`git --no-pager show -s --format='%cE' HEAD`
6773

68-
scripts/publish/npm_prepare.sh angular2
69-
publishRepo "js" "${JS_BUILD_ARTIFACTS_DIR}"
74+
publishRepo "${COMPONENT}" "${JS_BUILD_ARTIFACTS_DIR}"
75+
done
7076

71-
scripts/publish/pub_prepare.sh angular2
72-
publishRepo "dart" "${DART_BUILD_ARTIFACTS_DIR}"
7377
echo "Finished publishing build artifacts"
74-
7578
else
7679
echo "Not building the upstream/master branch, build artifacts won't be published."
7780
fi

0 commit comments

Comments
 (0)