-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
91 lines (90 loc) · 3.1 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
trigger: none
stages:
- stage: PushApp
displayName: Push app
jobs:
- job: PreBuild
displayName: Prepare build
pool:
vmImage: 'macOS-latest'
steps:
- checkout: self
clean: true
persistCredentials: true
displayName: 'Checkout Git Repo'
- task: NodeTool@0
inputs:
versionSpec: '14.16.1'
displayName: 'Install Node'
- script: npm install -g standard-version
displayName: 'Install standard-version'
- script: git fetch --tags
displayName: 'Fetch tags'
- script: git tag -l | sort -V | tail -n 1 | xargs npm version --no-git-tag-version --allow-same-version
displayName: Update package.json locally with latest version number
- task: Npm@1
displayName: 'Generate changelog and calculate version number'
inputs:
command: 'custom'
customCommand: 'run changelog'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
- script: git push --follow-tags origin HEAD:$(Build.SourceBranchName)
displayName: 'Push git tag'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact'
inputs:
targetPath: '$(Build.SourcesDirectory)'
artifact: 'msresolver'
publishLocation: 'pipeline'
- job: BuildImage
displayName: Build image
dependsOn: PreBuild
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
clean: true
persistCredentials: true
displayName: 'Checkout Git Repo'
- script: git fetch --tags
displayName: 'Fetch tags'
- script: echo "##vso[task.setvariable variable=tag;]$(git describe --tags $(git rev-list --tags --max-count=1))"
displayName: Set tag variable
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'msresolver'
targetPath: $(Build.SourcesDirectory)
- script: |
echo ****Display****
ls -la
workingDirectory: '$(Pipeline.Workspace)/s'
displayName: 'Display Workspace'
- task: Docker@2
displayName: Build and push images to Azure Registry
inputs:
containerRegistry: 'Docker-Registry-NttData'
repository: '$(DOCKER_REPOSITORY)'
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
tags: |
$(tag)
latest
${{ else }}:
tags: |
dev
- task: Docker@2
displayName: Build and push images to GitHub Packages
inputs:
containerRegistry: 'Docker-Registry-Github-Kaytrust'
repository: '$(GITHUB_ACTOR)/$(DOCKER_REPOSITORY)'
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
tags: |
$(tag)
latest
${{ else }}:
tags: |
dev