This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
azure-pipelines.yml
83 lines (69 loc) · 2.09 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
trigger:
branches:
include:
- master
paths:
include:
- spec/*
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
persistCredentials: true
clean: true
- script: |
echo "##vso[task.setvariable variable=DocsDirectory]$(Build.ArtifactStagingDirectory)"
condition: and(succeeded(), in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/azure-pipelines'))
displayName: 'configure publish for CI'
- script: |
echo "##vso[task.setvariable variable=DocsDirectory]$(Build.ArtifactStagingDirectory)/pr/$(System.PullRequest.PullRequestNumber)"
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), variables['System.PullRequest.PullRequestNumber'])
displayName: 'configure publish for PR'
- script: |
echo "##vso[task.logissue type=error]Pipeline only supported for CI or PR builds"
exit 1
condition: and(succeeded(), eq(variables['DocsDirectory'], ''))
displayName: 'fail invalid build'
- script: |
git config user.email "[email protected]"
git config user.name "Ron Buckton"
displayName: 'configure git user'
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
displayName: 'npm install'
- script: |
gulp build
displayName: 'gulp build'
- task: CopyFiles@2
inputs:
SourceFolder: docs
TargetFolder: $(DocsDirectory)
OverWrite: true
displayName: 'Copy Build Artifacts'
- task: PublishBuildArtifacts@1
inputs:
PathToPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: 'drop'
publishLocation: 'Container'
displayName: 'Publish Build Artifacts'
- script: |
git fetch origin gh-pages
git checkout gh-pages --force
git clean -fdx
displayName: 'checkout gh-pages'
- task: CopyFiles@2
inputs:
SourceFolder: $(Build.ArtifactStagingDirectory)
TargetFolder: $(Build.SourcesDirectory)
OverWrite: true
displayName: 'Copy built outputs'
- script: |
git add --all
git status
git commit -m "(chore) Publish update to gh-pages"
git push origin gh-pages
displayName: 'publish gh-pages'