-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines.yaml
53 lines (45 loc) · 1.31 KB
/
azure-pipelines.yaml
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
# Node.js with Vue
# Build a Node.js project that uses Vue.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.12.2'
displayName: 'Install Node.js'
- script: |
npm install -g pnpm
pnpm install
displayName: 'PNPM install'
- script: |
pnpm test
displayName: 'PNPM test'
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
- script: |
pnpm build
tar zcvf dist.tar.gz dist
displayName: 'PNPM build'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: CopyFilesOverSSH@0
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
sshEndpoint: TencentCloud
contents: 'dist.tar.gz'
targetFolder: '/tmp'
readyTimeout: '20000'
overwrite: true
displayName: 'Copy files to the remote machine'
- task: SSH@0
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
sshEndpoint: TencentCloud
runOptions: 'inline'
inline: |
tar -zxvf /tmp/dist.tar.gz -C /tmp
rm -rf $(DEPLOY_DIR)/dist /tmp/dist.tar.gz
mv /tmp/dist $(DEPLOY_DIR)/dist
displayName: 'Deploy'