-
Notifications
You must be signed in to change notification settings - Fork 279
/
Copy pathazure-pipelines.yml
100 lines (95 loc) · 3.35 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
branches:
include:
- master
- dev
- release/*
paths:
include:
- /
exclude:
- docs/*
# should trigger builds for PRs targeting any of the listed branches
# should _not_ trigger builds for PRs that _only_ have changes in the docs folder
# should trigger builds for PRs that have changes in both docs folder _and_ any other folder besides docs
pr:
branches:
include:
- master
- dev
- release/*
paths:
include:
- /
exclude:
- docs/*
pool:
# todo: we dgaf what specific version of Linux is installed, is there any way to wildcard the version?
vmImage: 'Ubuntu-16.04'
variables:
shouldPublish: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}:
branchName: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
branchName: $[ replace(variables['System.PullRequest.SourceBranch'], 'refs/heads/', '') ]
steps:
- script: |
npm ci
displayName: 'npm ci'
- script: |
npm run bootstrap:ci
displayName: 'bootstrapping packages'
- script: |
npm run build-packages
displayName: 'building packages'
- script: |
npm run lint-packages
displayName: 'linting packages'
- script: |
npm run lint-apps
displayName: 'linting apps'
- script: |
npm run coverage-packages
displayName: 'running tests'
env: {
testEnv: 'ci'
}
#
# LERNA VERSION
# * Configure git with a commit user
# * Update git remote to include a Personal Access Token, so lerna can push
# * Explicitly check out the current branch since Pipelines will use disconnected HEAD by default
# * Increment pre-release version
# * Force version update even if lerna doesn't detect changes
# * Include [skip ci] in commit message to stop pipeline from triggering again when lerna pushes
# * Only run for 'dev' branch
#
- script: |
git config user.email [email protected]
git config user.name "Automated Build"
git remote set-url origin https://[email protected]/Sitecore/jss.git
git checkout $(branchName)
$(npm bin)/lerna version prerelease --preid canary --force-publish --message "version %s [skip ci]" --yes
displayName: 'pre-release version update'
condition: and(succeeded(), eq(variables.shouldPublish, true))
env:
GITHUB_PAT_ENV: $(GITHUB-PAT)
#
# LERNA PUBLISH
# * Configure npm to use the provided access token, so lerna can publish
# * Do a lerna canary publish of the version we've already updated and pushed
# * Disable access verification (no-verify-access) as this doesn't seem to work behind Azure DevOps' npm proxy
# * https://github.com/lerna/lerna/issues/1685
# * Only run for 'dev' branch
#
- script: |
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
$(npm bin)/lerna publish from-git --canary --pre-dist-tag canary --preid canary --no-verify-access --yes
displayName: 'pre-release canary publish'
condition: and(succeeded(), eq(variables.shouldPublish, true))
env:
NPM_TOKEN: $(NPM-TOKEN)