forked from HealthCatalyst/Fabric.Cashmere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
83 lines (67 loc) · 1.85 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
trigger:
batch: true
branches:
include:
- master
- dev
# TODO: make `main` the main branch
- main
variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: 14.x
displayName: install Node.js
- script: |
npm ci
displayName: npm install
- script: |
npm run lint
displayName: npm run lint
- script: |
npm run test:unit
displayName: run unit tests
- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
testResultsFiles: 'test-results/test-results.xml'
testRunTitle: Angular unit test run
displayName: publish test results
condition: always()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: 'test-results/coverage/cobertura.xml'
reportDirectory: coverage
displayName: publish code coverage
condition: always()
- script: |
npm run build
displayName: build the Cashmere library
- script: |
# fail the script if any errors occur
set -e
cd dist/user-guide/
# Copy redirection error page for Github Pages
cp index.html 404.html
# Redirect Cashmere Url to CNAME file
echo $CASHMERE_URL > "CNAME"
git config --global user.email "$(GIT_EMAIL)"
git config --global user.name "$(GIT_USER_NAME)"
git init
git add .
git commit -m "Committing built docs for GitHub Pages"
git checkout -b gh-pages
git remote add origin https://$(GITHUB_TOKEN)@github.com/HealthCatalyst/Fabric.Cashmere.git
git push origin gh-pages --force
condition: and(succeeded(), eq(variables.isMain, 'true'))
displayName: 'publish GitHub pages (Docs site)'
- script: |
npx semantic-release
displayName: 'publish NPM package'
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
NPM_TOKEN: $(NPM_TOKEN)