-
Notifications
You must be signed in to change notification settings - Fork 103
/
azure-pipelines.yml
135 lines (116 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
trigger:
- master
- next
- hotfix/*
- bugfix/*
- alpha/*
jobs:
- job: buildanddeploy
pool:
vmImage: 'ubuntu-latest'
variables:
NPM_CACHE_FOLDER: $(Pipeline.Workspace)/.npm
nextRelease: unknown
steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
displayName: 'Install Node.js'
# - task: Cache@2
# inputs:
# key: 'npm | "$(Agent.OS)" | package-lock.json'
# path: "$(NPM_CACHE_FOLDER)"
# restoreKeys: |
# npm | "$(Agent.OS)"
# npm
# displayName: 'Cache NPM packages'
- script: |
mkdir -p $(NPM_CACHE_FOLDER)
npm -v
npm install
displayName: 'npm install'
#- script: |
# npm run test
# displayName: 'npm run test'
- script: |
npm run build
displayName: 'npm run build'
- script: >
npx -p semantic-release@19.0.5
-p @semantic-release/git
-p @semantic-release/changelog
-p semantic-release-ado
semantic-release
env: { GH_TOKEN: $(GitHubToken) }
displayName: 'Semantic release'
- powershell: |
echo "##vso[task.setvariable variable=versionNumber;isOutput=true]$(nextRelease)"
name: setOutputVar
- script: |
npmVersionString=$(node -p "require('./package.json').version")
echo "##vso[build.updatebuildnumber]$npmVersionString"
displayName: 'set build number'
- script: |
npm run build:storybook
displayName: 'npm run build:storybook'
env:
STORYBOOK_INTERNAL_ASSETS:
STORYBOOK_NPM_VERSION: $(nextRelease)
STORYBOOK_ASSETS: https://uikit.wfp.org/cdn/
- task: PublishPipelineArtifact@1
inputs:
targetPath: "./docs"
artifact: "wfp-ui-kit-build"
publishLocation: "pipeline"
- task: PublishPipelineArtifact@1
inputs:
targetPath: "./assets"
artifact: "wfp-ui-kit-assets"
publishLocation: "pipeline"
# - task: ArchiveFiles@2
# condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/heads/next'))
# inputs:
# rootFolderOrFile: "$(System.DefaultWorkingDirectory)/docs"
# includeRootFolder: true
# archiveType: "zip"
# archiveFile: "$(Build.ArtifactStagingDirectory)/build-$(Build.BuildId).zip"
# replaceExistingArchive: true
# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: "$(Build.ArtifactStagingDirectory)"
# ArtifactName: "wfp-ui-kit-build"
# publishLocation: "Container"
# - task: Bash@3
# inputs:
# targetType: 'inline'
# script: |
# PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
# echo "Package version"
# echo $PACKAGE_VERSION
# NPM_VERSION=${PACKAGE_VERSION//./-}
# echo $NPM_VERSION
# echo '##vso[task.setvariable variable=NPM_VAR]'$NPM_VERSION'
# - task: S3Upload@1
# inputs:
# awsCredentials: 'WFP UI-Kit'
# regionName: 'eu-west-1'
# bucketName: 'uikit.wfp.org'
# sourceFolder: './dist'
# globExpressions: '**'
# targetFolder: 'cdn/$(NPM_VAR)'
# filesAcl: 'public-read'
# createBucket: true
# logRequest: true
# logResponse: true
# - task: S3Upload@1
# inputs:
# awsCredentials: 'WFP UI-Kit'
# regionName: 'eu-west-1'
# bucketName: 'uikit.wfp.org'
# sourceFolder: './docs'
# globExpressions: '**'
# targetFolder: 'next-docs'
# filesAcl: 'public-read'
# createBucket: true
# logRequest: true
# logResponse: true