-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
69 lines (56 loc) · 1.95 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
# 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
variables:
- group: "Logverz Main Environment"
- name: S3LB
value: $[variables.S3LogicBucket]
trigger:
- dev
pool: #'Default'
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: 'Install Node.js'
- task: DownloadSecureFile@1
name: prodawsenvironment
displayName: 'Download .env file'
inputs:
secureFile: 'login.env'
- task: DownloadSecureFile@1
name: prodawsconfig
displayName: 'Download config.json file'
inputs:
secureFile: 'config.json'
- script: |
echo Installing $(prodawsconfig.secureFilePath) to the build/src directory...
echo $(prodawsconfig.secureFilePath) $(Build.Repository.LocalPath)/src/config.json
sudo mv $(prodawsconfig.secureFilePath) $(Build.Repository.LocalPath)/src/config.json
- script: |
echo Installing $(prodawsenvironment.secureFilePath) to the build directory...
configfile=$(prodawsenvironment.secureFilePath)
dynamicenvfile=$(echo $(prodawsenvironment.secureFilePath) |sed "s/login.env/.env/g")
echo "Dynamic Env File:" $dynamicenvfile
sudo mv $configfile $dynamicenvfile
sudo chown root:root $dynamicenvfile
sudo chmod 777 $dynamicenvfile
sudo ln -s -t $(Build.Repository.LocalPath) $dynamicenvfile
displayName: 'Link .env file'
- script: |
npm install
npm run build
displayName: 'npm install and build'
- script: |
sudo mkdir $(Build.Repository.LocalPath)/public
sudo mv $(Build.Repository.LocalPath)/build/* $(Build.Repository.LocalPath)/public
displayName: 'renaming build folder before deployment'
- task: S3Upload@1
inputs:
awsCredentials: 'MainAccountAccess'
regionName: 'ap-southeast-2'
bucketName: $(S3LB)
sourceFolder: '$(Build.Repository.LocalPath)'
globExpressions: 'public/**'