-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.dev-firm.yml
111 lines (96 loc) · 3.4 KB
/
azure-pipelines.dev-firm.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
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger: none
pr: none
pool:
vmImage: ubuntu-latest
stages:
- stage: build
displayName: 'Build package'
jobs:
- job: build_package
displayName: 'Build package'
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- script: npm install --global pnpm@latest-8
displayName: 'Install pnpm'
- task: DownloadSecureFile@1
name: envFile
displayName: 'Download development environment file'
inputs:
secureFile: 'autharmor-sdk.environment.development.ts'
- script: |
rm $(System.DefaultWorkingDirectory)/src/environment/environment.ts
mv $(envFile.secureFilePath) $(System.DefaultWorkingDirectory)/src/environment/environment.ts
displayName: 'Install development environment file'
- script: mv -f .dev.npmrc .npmrc
displayName: 'Install development .npmrc file'
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
- script: pnpm install
displayName: 'Install dependencies'
- script: pnpm run build
displayName: 'Build package'
- task: CopyFiles@2
displayName: 'Stage artifact files'
inputs:
contents: |
dist/**
package.json
.npmrc
README.md
targetFolder: $(Build.ArtifactStagingDirectory)
- publish: $(Build.ArtifactStagingDirectory)
artifact: autharmor-sdk
displayName: 'Publish package'
- stage: deploy
displayName: 'Deploy to Azure Artifacts'
dependsOn: build
jobs:
- deployment: deploy_to_artifacts
displayName: 'Deploy to Azure Artifacts'
environment: sdk-development
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: autharmor-sdk
- task: npmAuthenticate@0
inputs:
workingFile: $(Pipeline.Workspace)/autharmor-sdk/.npmrc
- script: npm publish
workingDirectory: $(Pipeline.Workspace)/autharmor-sdk/
- stage: deploy_storage
displayName: 'Deploy to Azure Storage'
dependsOn: build
jobs:
- deployment: deploy_to_storage
displayName: 'Deploy to Azure Storage'
environment: sdk-development
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: autharmor-sdk
- script: echo "console.log('##vso[task.setvariable variable=PackageVersion;]' + require('./package.json').version)" | node
displayName: 'Extract package version'
workingDirectory: $(Pipeline.Workspace)/autharmor-sdk/
- task: AzureCLI@2
inputs:
azureSubscription: 'Auth Armor Azure Dev Subscription'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az storage blob upload-batch \
--source "$(Pipeline.Workspace)/autharmor-sdk/dist/" \
--account-name dvdtstscripts \
--destination scripts \
--destination-path autharmor-js/$(PackageVersion)