Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: separate deploy jobs in deploy build stage #5621

Merged
merged 1 commit into from
Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
- env: "MODE=browserstack_required"
- env: "MODE=travis_required"
- stage: Deploy
script: ./scripts/ci/publish-artifacts.sh
env: "MODE=release"

env: "DEPLOY_MODE=build-artifacts"
- env: "DEPLOY_MODE=docs-content"
- env: "DEPLOY_MODE=screenshot-tool"
- env: "DEPLOY_MODE=dashboard"
env:
global:
- LOGS_DIR=/tmp/angular-material2-build/logs
Expand All @@ -51,7 +52,7 @@ before_script:
- mkdir -p $LOGS_DIR

script:
- ./scripts/ci/build-and-test.sh
- ./scripts/ci/travis-script.sh

cache:
directories:
Expand Down
Empty file modified scripts/ci/env.sh
100644 → 100755
Empty file.
35 changes: 0 additions & 35 deletions scripts/ci/publish-artifacts.sh

This file was deleted.

38 changes: 38 additions & 0 deletions scripts/ci/travis-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# Script that runs in the deploy stage after the testing stage of Travis passed.
# Build artifacts and docs content will be published to different repositories.

# The script should immediately exit if any command in the script fails.
set -e

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

# If the current Travis job is triggered by a pull request skip the deployment.
# This check is necessary because Travis still tries to run the deploy build-stage for
# pull requests.
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "Build artifacts and docs content will only be deployed in Travis push builds."
exit 0;
fi

echo ""
echo "Starting the deployment script. Running mode: ${DEPLOY_MODE}"
echo ""

if [[ "${DEPLOY_MODE}" == "build-artifacts" ]]; then
./scripts/deploy/publish-build-artifacts.sh
fi

if [[ "${DEPLOY_MODE}" == "docs-content" ]]; then
./scripts/deploy/publish-docs-content.sh
fi

if [[ "${DEPLOY_MODE}" == "screenshot-tool" ]]; then
./scripts/deploy/deploy-screenshot-functions.sh
fi

if [[ "${DEPLOY_MODE}" == "dashboard" ]]; then
./scripts/deploy/deploy-dashboard.sh
fi
21 changes: 21 additions & 0 deletions scripts/ci/travis-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Script that runs in every Travis CI container. The script is responsible for delegating
# to the different scripts that should run for specific Travis jobs in a build stage.

# The script should immediately exit if any command in the script fails.
set -e

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

if [[ -z "$TRAVIS" ]]; then
echo "This script can only run inside of Travis build jobs."
exit 1
fi

if [[ "${MODE}" ]]; then
./scripts/ci/travis-testing.sh
elif [[ "${DEPLOY_MODE}" ]]; then
./scripts/ci/travis-deploy.sh
fi
3 changes: 3 additions & 0 deletions scripts/ci/build-and-test.sh → scripts/ci/travis-testing.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Script that runs in the testing build stage of Travis and is responsible for testing
# the project in different Travis jobs of the current build stage.

# The script should immediately exit if any command in the script fails.
set -e

Expand Down