Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ before_script:
script:
- ./scripts/ci/build-and-test.sh

after_success:
- ./scripts/ci/after-success.sh

cache:
directories:
- node_modules
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"strip-ansi": "^3.0.0",
"stylelint": "^7.5.0",
"symlink-or-copy": "^1.0.1",
"travis-after-modes": "0.0.5",
"ts-node": "^0.7.3",
"tslint": "^3.13.0",
"typedoc": "^0.5.1",
Expand Down
11 changes: 11 additions & 0 deletions scripts/ci/after-success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a top-level comment explaining the purpose of this file

# Go to the project root directory
cd $(dirname $0)/../..

RESULT=`$(npm bin)/travis-after-modes`

if [ "$RESULT" = "PASSED" ] && [ -z "$TRAVIS_PULL_REQUEST" ]; then
echo "All travis modes passed. Publishing the build artifacts..."
./scripts/release/publish-build-artifacts.sh
fi
43 changes: 43 additions & 0 deletions scripts/release/publish-build-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a top-level comment explaining the purpose of this file

# Go to the project root directory
cd $(dirname $0)/../..

BUILD_DIR="dist/@angular/material"
BUILD_VERSION=`sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using $( ... ) over ticks for bash:

# Extract the current version from package.json
BUILD_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)

(here and elsewhere)


COMMIT_SHA=`git rev-parse --short HEAD`
COMMIT_AUTHOR=`git --no-pager show -s --format='%an <%ae>' HEAD`
COMMIT_MESSAGE=`git log --oneline | head -n1`

REPO_NAME="material-builds"
REPO_URL="http://github.com/DevVersion/material-builds.git"
REPO_DIR="tmp/$REPO_NAME"

# Create a release of the current repository.
$(npm bin)/gulp build:release

# Prepare cloning the builds repository
rm -rf $REPO_DIR
mkdir -p $REPO_DIR

# Clone the repository
git clone $REPO_URL $REPO_DIR

# Copy the build files to the repository
rm -rf $REPO_DIR/*
cp -r $BUILD_DIR/* $REPO_DIR

# Create the build commit and push the changes to the repository.
cd $REPO_DIR &&

# Setup the git repository authentication.
git config credential.helper "store --file=.git/credentials" &&
echo "$MATERIAL2_BUILDS_TOKEN" > .git/credentials

git add -A &&
git commit -m "$COMMIT_MESSAGE" --author "$COMMIT_AUTHOR" &&
git tag "$BUILD_VERSION-$COMMIT_SHA" &&
git push origin master --tags

echo "Finished publishing build artifacts"