Skip to content

Commit 1a9472e

Browse files
devversionjelbourn
authored andcommitted
build: move snapshot publish job to circleci (#13882)
Also switch to a single GitHub deploy token
1 parent f087f73 commit 1a9472e

File tree

5 files changed

+49
-12
lines changed

5 files changed

+49
-12
lines changed

.circleci/config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@ jobs:
202202

203203
- *save_cache
204204

205+
# ----------------------------------------
206+
# Job that publishes the build snapshots
207+
# ----------------------------------------
208+
publish_snapshots:
209+
<<: *job_defaults
210+
steps:
211+
# Since CircleCI currently does not have any way to easily restrict jobs to only run
212+
# for push builds, we need to manually skip publishing if the jobs runs for a PR.
213+
# https://discuss.circleci.com/t/workflows-pull-request-filter/14396/11
214+
- run:
215+
name: Check whether this job should be skipped.
216+
command: '[[ -n ${CIRCLE_PR_NUMBER} ]] && circleci step halt || true'
217+
218+
- *checkout_code
219+
- *restore_cache
220+
- *yarn_install
221+
- *attach_release_output
222+
223+
- run: ./scripts/circleci/publish-snapshots.sh
224+
225+
- *save_cache
226+
205227
# ----------------------------------------------------------------------------------------
206228
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
207229
# one job depends on another.
@@ -234,6 +256,9 @@ workflows:
234256
- build_demoapp_aot:
235257
requires:
236258
- build_release_packages
259+
- publish_snapshots:
260+
requires:
261+
- build_release_packages
237262

238263
# Lint workflow. As we want to lint in one job, this is a workflow with just one job.
239264
lint:

.travis.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,8 @@ branches:
2525

2626
jobs:
2727
include:
28-
- env: "MODE=aot"
2928
- env: "MODE=payload"
30-
- env: "MODE=prerender"
3129
- env: "MODE=saucelabs_required"
32-
- env: "MODE=browserstack_required"
33-
- env: "DEPLOY_MODE=build-artifacts"
34-
if: type = push
35-
- env: "DEPLOY_MODE=docs-content"
36-
if: type = push
3730
- env: "DEPLOY_MODE=dashboard"
3831
if: type = cron
3932
env:

scripts/circleci/publish-snapshots.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# This script should fail if one of the individual publish scripts fails.
4+
set -e
5+
6+
# Go to project directory.
7+
cd $(dirname ${0})/../..
8+
9+
# Deploy build artifacts to the GitHub build repositories. The release output is already
10+
# fetched from the CircleCI workspace storage.
11+
./scripts/deploy/publish-build-artifacts.sh --no-build
12+
13+
# Build the docs output before publishing the docs content.
14+
yarn gulp docs
15+
16+
# Deploy the docs content to the Github repository. We don't want to build the examples
17+
# package here again because it's already fetched from the CircleCI workspace storage.
18+
./scripts/deploy/publish-docs-content.sh --no-build
19+

scripts/deploy/publish-build-artifacts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ publishPackage() {
3131

3232
buildDir="$(pwd)/dist/releases/${packageName}"
3333
buildVersion=$(node -pe "require('./package.json').version")
34-
branchName=${TRAVIS_BRANCH:-'master'}
34+
branchName=${CIRCLE_BRANCH:-'master'}
3535

3636
commitSha=$(git rev-parse --short HEAD)
3737
commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)

scripts/deploy/publish-docs-content.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ set -e
88

99
cd "$(dirname $0)/../../"
1010

11-
if [ -z ${MATERIAL2_DOCS_CONTENT_TOKEN} ]; then
11+
if [ -z ${MATERIAL2_BUILDS_TOKEN} ]; then
1212
echo "Error: No access token for GitHub could be found." \
13-
"Please set the environment variable 'MATERIAL2_DOCS_CONTENT_TOKEN'."
13+
"Please set the environment variable 'MATERIAL2_BUILDS_TOKEN'."
1414
exit 1
1515
fi
1616

@@ -38,7 +38,7 @@ docsContentRepoUrl="https://github.com/angular/material2-docs-content"
3838
buildVersion=$(node -pe "require('./package.json').version")
3939

4040
# Name of the branch that is currently being deployed.
41-
branchName=${TRAVIS_BRANCH:-'master'}
41+
branchName=${CIRCLE_BRANCH:-'master'}
4242

4343
# Additional information about the last commit for docs-content commits.
4444
commitSha=$(git rev-parse --short HEAD)
@@ -117,7 +117,7 @@ git config user.name "$commitAuthorName"
117117
git config user.email "$commitAuthorEmail"
118118
git config credential.helper "store --file=.git/credentials"
119119

120-
echo "https://${MATERIAL2_DOCS_CONTENT_TOKEN}:@github.com" > .git/credentials
120+
echo "https://${MATERIAL2_BUILDS_TOKEN}:@github.com" > .git/credentials
121121

122122
echo "Credentials for docs-content repository are now set up. Publishing.."
123123

0 commit comments

Comments
 (0)