forked from AxaFrance/react-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
78 lines (64 loc) · 3.55 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
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: SonarCloud
organization: axaguildev
scannerMode: CLI
configMode: manual
cliProjectKey: 'AxaGuilDEv_react-toolkit'
cliProjectName: 'react-toolkit'
extraProperties: |
sonar.exclusions=**/*.stories.*,**/*.spec.*,scripts/**,coverage/**,**/node_modules/**,**/dist/**,**/__mocks__/**,examples/**,storybook/**,jest.config.js,gulpfile.js,**/*.scss,**/__snapshots__/**,**/*.svg,**/*.txt,**/*.woff,**/*.ico
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.sourceEncoding=UTF-8
sonar.verbose=true
sonar.cfamily.build-wrapper-output.bypass=true
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'False'))
- script: npm ci
displayName: 'npm install'
- script: npm test -- --coverage
displayName: 'npm test'
- script: npm run check
displayName: 'npm run check'
- script: npm run storybook:build
displayName: 'build storybook'
- script: |
git config --global user.email "[email protected]"
git config --global user.name "Build-CI"
git reset --hard
git remote set-url origin https://$(Github.Token)@github.com/AxaGuilDEv/react-toolkit.git
git checkout $(Build.SourceBranchName)
node ./scripts/npm.js $(NPM_TOKEN)
cp .npmrc $HOME/.npmrc
git status
displayName: 'configuration'
condition: and(succeeded(), ne(variables['Npm.Publish.Version'], 'none'))
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'False'))
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'False'))
- script: npm run publish -- $(Npm.Publish.Version) --exact --yes --concurrency 1 --force-publish
displayName: 'lerna publish latest'
condition: and(succeeded(), startsWith(variables.Build.SourceBranchName, 'release/'), notIn(variables['Npm.Publish.Version'], 'none', 'premajor', 'preminor', 'prepatch', 'prerelease'))
- script: npm run publish -- $(Npm.Publish.Version) --dist-tag next --exact --yes --concurrency 1 --force-publish
displayName: 'lerna publish next'
condition: and(succeeded(), eq(variables.Build.SourceBranchName, 'master'), in(variables['Npm.Publish.Version'], 'premajor', 'preminor', 'prepatch', 'prerelease'))
- script: node ./scripts/publish-docs.js $(Github.Token) && node ./scripts/publish-changelog.js $(Github.Token)
displayName: 'push documentation and changelog'
condition: and(succeeded(), notIn(variables['Npm.Publish.Version'], 'none', 'premajor', 'preminor', 'prepatch', 'prerelease'))
- script: node ./scripts/twitter.js $(Twitter.consumer_key) $(Twitter.consumer_secret) $(Twitter.access_token) $(Twitter.access_token_secret)
displayName: 'Auto tweet'
condition: and(succeeded(), notIn(variables['Npm.Publish.Version'], 'none', 'premajor', 'preminor', 'prepatch', 'prerelease'))