-
Notifications
You must be signed in to change notification settings - Fork 59
/
azure-pipelines.yml
59 lines (51 loc) · 1.91 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
name: $(Build.BuildID)
pool:
vmImage: "ubuntu-20.04"
variables:
- group: Secrets
steps:
- task: PowerShell@2
displayName: set docker and pipeline tag
env:
AZURE_DEVOPS_EXT_PAT: $(AZURE_CLI)
GOOGLE_API_KEY: $(GOOGLE_API_KEY)
inputs:
targetType: "inline"
script: |
if(!("$(Build.Reason)".Equals("PullRequest"))){
Write-Host "##vso[task.setvariable variable=TAG]$(Build.BuildID)"
Write-Host "##vso[task.setvariable variable=IS_LATEST]latest"
Write-Host "Masterversion: $(Build.BuildID)"
} else {
Write-Host "##vso[task.setvariable variable=TAG]dev-$(System.PullRequest.PullRequestNumber)"
Write-Host "##vso[task.setvariable variable=IS_LATEST]"
Write-Host "PR-Version: dev-$(System.PullRequest.PullRequestNumber)"
if("$(System.PullRequest.SourceBranch)".StartsWith("DEPLOY_")) {
$pr_name = "$(System.PullRequest.SourceBranch)".Split("_")[1]
Write-Host "##vso[task.setvariable variable=PR_NAME]$pr_name"
az pipelines build tag add --build-id $(Build.BuildID) --tags pr-deployment --organization https://dev.azure.com/w3champions/ --project w3champions
}
}
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace tokens'
inputs:
targetFiles: |
**/*.token.yml => *.yml
**/*.ts.token => *.ts
- task: Docker@2
inputs:
containerRegistry: "official-docker-modmoto"
repository: "modmoto/w3champions-ui"
command: "buildAndPush"
Dockerfile: "**/Dockerfile"
buildContext: "."
tags: |
$(TAG)
- task: CopyFiles@2
displayName: publish docker-compose files
inputs:
contents: '**/*docker-compose.yml'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)