-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
56 lines (46 loc) · 1.59 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
trigger:
branches:
include:
- master
pool:
name: $(kubernetesLinuxAgentPoolName)
variables:
- group: PipelineSoftwareVersions
- group: ConnectorLibraries
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: $(gitVersionVersion)
includePrerelease: true
- task: gitversion/execute@0
displayName: Run GitVersion
inputs:
useConfigFile: true
configFilePath: 'git-version.yml'
- task: npmAuthenticate@0
inputs:
workingFile: ./.npmrc
customEndpoint: 'NPM JS Registry'
displayName: 'Npm Authenticate'
- script: yarn install
displayName: 'Yarn install'
- script: yarn build
displayName: 'Yarn build'
- script: |
latestPublishedPackage=$(yarn info @templafy/delivery-connector-library@$(GitVersion.SemVer) --json | jq .data | jq -r '.["dist-tags"]["latest"]')
echo $latestPublishedPackage
if [[ $latestPublishedPackage == $(GitVersion.SemVer) ]]; then
echo "Npm package with version $(GitVersion.SemVer) is already pushed."
echo "##vso[task.setvariable variable=packageExists]true"
else
echo "Npm package with version $(GitVersion.SemVer) is not pushed."
echo "##vso[task.setvariable variable=packageExists]false"
fi
displayName: 'Check if package was already published'
- script: yarn publish --new-version $(GitVersion.SemVer) --no-git-tag-version --access public
workingDirectory: ./build
displayName: 'Yarn publish'
condition: ne(variables['packageExists'],'true')
- script: 'git push https://$(GitHubToken)@github.com/templafy/DeliveryConnectorLibrary.git'
displayName: Push to GitHub