-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
94 lines (92 loc) · 3.6 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
trigger:
- main
pool:
vmImage: macOS-12
stages:
- stage: CI
displayName: Continuous integration
jobs:
- job: Build
displayName: Build and test
steps:
- task: NodeTool@0
inputs:
versionSpec: "16.x"
displayName: "Install Node.js"
- script: npm i
displayName: "Install dependencies"
- script: npm run build:electron
displayName: "Build"
- script: npm run test -- --browsers ChromeNoSandboxHeadless --watch=false
displayName: "Run tests"
- script: npm run pack -- --publish never
displayName: "Pack"
- task: PublishPipelineArtifact@1
displayName: "Create artifact"
inputs:
targetPath: "$(Build.SourcesDirectory)/dist"
publishLocation: "pipeline"
artifact: "application"
- stage: Deployment
displayName: Deployment
dependsOn: CI
condition: and(succeeded('CI'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- job: PreValidation
displayName: Pre-validation
steps:
- task: Bash@3
displayName: Retrieve version number
name: retrieveVersion
inputs:
targetType: "inline"
script: |
echo "##vso[task.setvariable variable=RELEASE_VERSION;isreadonly=true;isoutput=true]$(grep version package.json | sed 's/.*"version": "\(.*\)".*/\1/')"
- job: WaitForValidation
displayName: Wait for validation
dependsOn: PreValidation
pool: server
timeoutInMinutes: 4320 # wait 3 days
variables:
RELEASE_VERSION: $[ dependencies.PreValidation.outputs['retrieveVersion.RELEASE_VERSION'] ]
steps:
- task: ManualValidation@0
displayName: Wait for approval
inputs:
notifyUsers: "*"
instructions: "Resume to create a release of version $(RELEASE_VERSION)."
- deployment: Release
displayName: Create release
dependsOn: WaitForValidation
environment: main
strategy:
runOnce:
deploy:
steps:
- task: Bash@3
displayName: Retrieve version number
inputs:
targetType: "inline"
script: |
echo "##vso[task.setvariable variable=RELEASE_VERSION;isreadonly=true]$(grep version $(Pipeline.Workspace)/application/latest.yml | cut -d ' ' -f2-)"
- task: Bash@3
displayName: Evaluate pre-release
inputs:
targetType: "inline"
script: |
echo "##vso[task.setvariable variable=IS_PRERELEASE;isreadonly=true]$(if [[ $(RELEASE_VERSION) == *"beta"* ]]; then echo "true"; else echo "false"; fi)"
- task: GitHubRelease@1
inputs:
gitHubConnection: "Opdex Desktop"
repositoryName: "Opdex/opdex-desktop"
action: "create"
target: "$(Build.SourceVersion)"
tagSource: "userSpecifiedTag"
tag: "$(RELEASE_VERSION)"
title: "Opdex Desktop $(RELEASE_VERSION)"
assets: "$(Pipeline.Workspace)/application/*"
isDraft: true
isPreRelease: $(IS_PRERELEASE)
addChangeLog: true
changeLogType: commitBased
changeLogCompareToRelease: lastFullRelease