Skip to content

Commit e190c16

Browse files
committed
chore: create build artifacts for each commit
1 parent 3fd3117 commit e190c16

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ before_script:
5252
script:
5353
- ./scripts/ci/build-and-test.sh
5454

55+
after_success:
56+
- ./scripts/ci/after-success.sh
57+
5558
cache:
5659
directories:
5760
- node_modules

scripts/ci/after-success.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Go to the project root directory
4+
cd $(dirname $0)/../..
5+
6+
# Download and run the Travis After All script to retrieve information about other build modes.
7+
curl -Lo travis_after_all.py https://raw.github.com/dmakhno/travis_after_all/master/travis_after_all.py
8+
python travis_after_all.py
9+
10+
if [ "$BUILD_LEADER" = "YES" ] && [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then
11+
12+
echo "All other builds succeeded. Publishing build"
13+
# ./scripts/release/publish-build-artifacts.sh
14+
fi
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Go to the project root directory
4+
cd $(dirname $0)/../..
5+
6+
BUILD_DIR="dist/@angular/material"
7+
BUILD_VERSION=`sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json`
8+
9+
COMMIT_SHA=`git rev-parse --short HEAD`
10+
COMMIT_AUTHOR=`git --no-pager show -s --format='%an <%ae>' HEAD`
11+
COMMIT_MESSAGE=`git log --oneline | head -n1`
12+
13+
REPO_NAME="material-builds"
14+
REPO_URL="http://github.com/DevVersion/material-builds.git"
15+
REPO_DIR="tmp/$REPO_NAME"
16+
17+
# Create a release of the current repository.
18+
$(npm bin)/gulp build:release
19+
20+
# Prepare cloning the builds repository
21+
rm -rf $REPO_DIR
22+
mkdir -p $REPO_DIR
23+
24+
# Clone the repository
25+
git clone $REPO_URL $REPO_DIR
26+
27+
# Copy the build files to the repository
28+
rm -rf $REPO_DIR/*
29+
cp -r $BUILD_DIR/* $REPO_DIR
30+
31+
# Create the build commit and push the changes to the repository.
32+
cd $REPO_DIR &&
33+
34+
# Setup the git repository authentication.
35+
git config credential.helper "store --file=.git/credentials" &&
36+
echo "$GITHUB_TOKEN_ANGULAR" > .git/credentials
37+
38+
git add -A &&
39+
git commit -m "$COMMIT_MESSAGE" --author "$COMMIT_AUTHOR" &&
40+
git tag "$BUILD_VERSION-$COMMIT_SHA" &&
41+
git push origin master --tags
42+
43+
echo "Finished publishing build artifacts"

0 commit comments

Comments
 (0)