feature(DEVELOPER.md): add easy way to publish personal snapshot builds (#13469)
This commit is contained in:
parent
33910ddfc9
commit
01d1624884
21
DEVELOPER.md
21
DEVELOPER.md
|
@ -1,6 +1,6 @@
|
||||||
# Building and Testing Angular 2 for JS
|
# Building and Testing Angular
|
||||||
|
|
||||||
This document describes how to set up your development environment to build and test Angular 2 JS version.
|
This document describes how to set up your development environment to build and test Angular.
|
||||||
It also explains the basic mechanics of using `git`, `node`, and `npm`.
|
It also explains the basic mechanics of using `git`, `node`, and `npm`.
|
||||||
|
|
||||||
* [Prerequisite Software](#prerequisite-software)
|
* [Prerequisite Software](#prerequisite-software)
|
||||||
|
@ -137,4 +137,21 @@ You can automatically format your code by running:
|
||||||
$ gulp format
|
$ gulp format
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Publishing your own personal snapshot build
|
||||||
|
|
||||||
|
You may find that your un-merged change needs some validation from external participants.
|
||||||
|
Rather than requiring them to pull your Pull Request and build Angular locally, you can
|
||||||
|
publish the `*-builds` snapshots just like our Travis build does.
|
||||||
|
|
||||||
|
First time, you need to create the github repositories:
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
$ export TOKEN=[get one from https://github.com/settings/tokens]
|
||||||
|
$ CREATE_REPOS=1 ./scripts/publish/publish-build-artifacts.sh [github username]
|
||||||
|
```
|
||||||
|
|
||||||
|
For subsequent snapshots, just run
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
$ ./scripts/publish/publish-build-artifacts.sh [github username]
|
||||||
|
```
|
||||||
|
|
|
@ -9,7 +9,12 @@ function publishRepo {
|
||||||
BUILD_REPO="${COMPONENT}-builds"
|
BUILD_REPO="${COMPONENT}-builds"
|
||||||
REPO_DIR="tmp/${BUILD_REPO}"
|
REPO_DIR="tmp/${BUILD_REPO}"
|
||||||
|
|
||||||
echo "Pushing build artifacts to angular/${BUILD_REPO}"
|
if [ -n "$CREATE_REPOS" ]; then
|
||||||
|
curl -u "$ORG:$TOKEN" https://api.github.com/user/repos \
|
||||||
|
-d '{"name":"'$BUILD_REPO'", "auto_init": true}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Pushing build artifacts to ${ORG}/${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
|
||||||
|
@ -37,14 +42,18 @@ function publishRepo {
|
||||||
for UMD_FILE in ${UMD_FILES}; do
|
for UMD_FILE in ${UMD_FILES}; do
|
||||||
sed -i "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g" ${UMD_FILE}
|
sed -i "s/\\\$\\\$ANGULAR_VERSION\\\$\\\$/${BUILD_VER}/g" ${UMD_FILE}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
(
|
||||||
|
cd $REPO_DIR && \
|
||||||
|
git config credential.helper "store --file=.git/credentials" && \
|
||||||
|
echo "https://${GITHUB_TOKEN_ANGULAR}:@github.com" > .git/credentials
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
echo `date` > $REPO_DIR/BUILD_INFO
|
echo `date` > $REPO_DIR/BUILD_INFO
|
||||||
echo $SHA >> $REPO_DIR/BUILD_INFO
|
echo $SHA >> $REPO_DIR/BUILD_INFO
|
||||||
|
|
||||||
(
|
(
|
||||||
cd $REPO_DIR && \
|
cd $REPO_DIR && \
|
||||||
git config credential.helper "store --file=.git/credentials" && \
|
|
||||||
echo "https://${GITHUB_TOKEN_ANGULAR}:@github.com" > .git/credentials && \
|
|
||||||
git config user.name "${COMMITTER_USER_NAME}" && \
|
git config user.name "${COMMITTER_USER_NAME}" && \
|
||||||
git config user.email "${COMMITTER_USER_EMAIL}" && \
|
git config user.email "${COMMITTER_USER_EMAIL}" && \
|
||||||
git add --all && \
|
git add --all && \
|
||||||
|
@ -55,9 +64,7 @@ function publishRepo {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Publish all individual packages from packages-dist.
|
# Publish all individual packages from packages-dist.
|
||||||
if [[ "$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
function publishPackages {
|
||||||
"$TRAVIS_PULL_REQUEST" == "false" && \
|
|
||||||
"$CI_MODE" == "e2e" ]]; then
|
|
||||||
for dir in dist/packages-dist/*/ dist/tools/@angular/tsc-wrapped
|
for dir in dist/packages-dist/*/ dist/tools/@angular/tsc-wrapped
|
||||||
do
|
do
|
||||||
COMPONENT="$(basename ${dir})"
|
COMPONENT="$(basename ${dir})"
|
||||||
|
@ -66,10 +73,13 @@ if [[ "$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
||||||
COMPONENT="${COMPONENT//_/-}"
|
COMPONENT="${COMPONENT//_/-}"
|
||||||
JS_BUILD_ARTIFACTS_DIR="${dir}"
|
JS_BUILD_ARTIFACTS_DIR="${dir}"
|
||||||
|
|
||||||
REPO_URL="https://github.com/angular/${COMPONENT}-builds.git"
|
if [[ "$1" -eq "ssh" ]]; then
|
||||||
# Use the below URL for testing when using SSH authentication
|
REPO_URL="git@github.com:${ORG}/${COMPONENT}-builds.git"
|
||||||
# REPO_URL="git@github.com:angular/${COMPONENT}-builds.git"
|
elif [[ "$1" -eq "http" ]]; then
|
||||||
|
REPO_URL="https://github.com/${ORG}/${COMPONENT}-builds.git"
|
||||||
|
else
|
||||||
|
die "Don't have a way to publish to scheme $1"
|
||||||
|
fi
|
||||||
SHA=`git rev-parse HEAD`
|
SHA=`git rev-parse HEAD`
|
||||||
SHORT_SHA=`git rev-parse --short HEAD`
|
SHORT_SHA=`git rev-parse --short HEAD`
|
||||||
COMMIT_MSG=`git log --oneline | head -n1`
|
COMMIT_MSG=`git log --oneline | head -n1`
|
||||||
|
@ -80,6 +90,18 @@ if [[ "$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Finished publishing build artifacts"
|
echo "Finished publishing build artifacts"
|
||||||
|
}
|
||||||
|
|
||||||
|
# See DEVELOPER.md for help
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
ORG=$1
|
||||||
|
publishPackages "ssh"
|
||||||
|
elif [[ \
|
||||||
|
"$TRAVIS_REPO_SLUG" == "angular/angular" && \
|
||||||
|
"$TRAVIS_PULL_REQUEST" == "false" && \
|
||||||
|
"$CI_MODE" == "e2e" ]]; then
|
||||||
|
ORG="angular"
|
||||||
|
publishPackages "http"
|
||||||
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