Skip to content

Commit 406ace9

Browse files
committed
chore(build): deploy build artifacts to build branches
- use orphan branch - use upstream .gitignore - use short SHA in commit messages - tag commits with source SHA Closes angular#5203
1 parent 6d70cd7 commit 406ace9

3 files changed

Lines changed: 67 additions & 4 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ after_script:
9090
- node tools/analytics/build-analytics start ci after_script
9191
- ./scripts/ci/print-logs.sh
9292
- ./scripts/ci/after-script.sh
93+
- ./scripts/ci/publish-build-artifacts.sh
9394
- node tools/analytics/build-analytics success ci after_script
9495
- if [[ $TRAVIS_TEST_RESULT -eq 0 ]]; then node tools/analytics/build-analytics success ci job; else node tools/analytics/build-analytics error ci job; fi
9596

scripts/ci/presubmit-queue-setup.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e -o pipefail
33

44
if [ "$TRAVIS_REPO_SLUG" = "angular/angular" ]; then
5-
if [[ $TRAVIS_BRANCH == "presubmit-"* ]]; then
5+
if [[ $TRAVIS_BRANCH == "presubmit-"* || $MODE == "build_only" ]]; then
66

77
echo '*********************'
88
echo '** PRESUBMIT SETUP **'
@@ -14,8 +14,10 @@ if [ "$TRAVIS_REPO_SLUG" = "angular/angular" ]; then
1414
git config user.name "`git --no-pager show -s --format='%cN' HEAD`"
1515
git config user.email "`git --no-pager show -s --format='%cE' HEAD`"
1616

17-
git remote add upstream https://github.com/angular/angular.git
18-
git fetch upstream master
19-
git rebase upstream/master
17+
if [[ $TRAVIS_BRANCH == "presubmit-"* ]]; then
18+
git remote add upstream https://github.com/angular/angular.git
19+
git fetch upstream master
20+
git rebase upstream/master
21+
fi
2022
fi
2123
fi
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
set -e -x
3+
4+
DART_BUILD_ARTIFACTS_DIR="dist/dart/angular2"
5+
JS_BUILD_ARTIFACTS_DIR="dist/js/prod/es5/angular2"
6+
7+
DART_BUILD_BRANCH="builds-dart"
8+
JS_BUILD_BRANCH="builds-js"
9+
10+
REPO_URL="https://github.com/angular/angular.git"
11+
# Use the below URL for testing when using SSH authentication
12+
# REPO_URL="git@github.com:angular/angular.git"
13+
14+
SHA=`git rev-parse HEAD`
15+
SHORT_SHA=`git rev-parse --short HEAD`
16+
COMMIT_MSG=`git log --oneline | head -n1`
17+
18+
function publishRepo {
19+
LANG=$1
20+
ARTIFACTS_DIR=$2
21+
22+
BUILD_BRANCH="builds-${LANG}"
23+
REPO_DIR="tmp/${BUILD_BRANCH}"
24+
25+
echo "Pushing build artifacts to angular/$BUILD_BRANCH"
26+
27+
# create local repo folder and clone build repo into it
28+
rm -rf $REPO_DIR
29+
mkdir -p $REPO_DIR
30+
(
31+
cd $REPO_DIR && \
32+
git init && \
33+
git remote add origin $REPO_URL && \
34+
git fetch origin $BUILD_BRANCH && \
35+
git checkout origin/$BUILD_BRANCH && \
36+
git checkout -b $BUILD_BRANCH
37+
)
38+
39+
# copy over build artifacts into the repo directory
40+
rm -rf $REPO_DIR/*
41+
cp -R $ARTIFACTS_DIR/* $REPO_DIR/
42+
cp .gitignore $REPO_DIR/
43+
echo `date` > $REPO_DIR/BUILD_INFO
44+
echo $SHA >> $REPO_DIR/BUILD_INFO
45+
46+
(
47+
cd $REPO_DIR && \
48+
git add --all && \
49+
git commit -m "${COMMIT_MSG}" && \
50+
git push origin $BUILD_BRANCH && \
51+
git tag "2.0.0-build.${SHORT_SHA}.${LANG}" && \
52+
git push origin --tags
53+
)
54+
}
55+
56+
if [ "$TRAVIS_REPO_SLUG" = "angular/angular" && "$MODE" == "build_only" ]; then
57+
publishRepo "js" "${JS_BUILD_ARTIFACTS_DIR}"
58+
publishRepo "dart" "${DART_BUILD_ARTIFACTS_DIR}"
59+
echo "Finished publishing build artifacts"
60+
fi

0 commit comments

Comments
 (0)