This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
forked from OfficeDev/script-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-pipeline-template.yml
101 lines (89 loc) · 4 KB
/
package-pipeline-template.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
parameters:
- name: PackageDirectory
displayName: Directory of the package where the package.json is
type: string
- name: PackageName
displayName: Name of the package to be built
type: string
- name: SiteName
displayName: Name of Azure Site
type: string
steps:
- checkout: self
persistCredentials: true
- task: Yarn@2
displayName: 'Install'
inputs:
Arguments: 'install --frozen-lockfile'
- task: Yarn@2
displayName: 'Pre-CI Script'
inputs:
Arguments: 'pre-ci'
- script: yarn postinstall
displayName: 'Post Install Script'
env:
BRANCH: '$(Build.SourceBranchName)'
- task: PowerShell@2
displayName: 'Check diff on post install'
inputs:
targetType: 'inline'
script: |
# This makes sure that someone ran "yarn install" after merging their PR, and that the postinstall doesn't produce any diffs, which are annoying/confusing
$diffs=$(git --no-pager diff HEAD --exit-code)
if([string]::IsNullOrEmpty($diffs)){
Write-Host "No diffs found"
exit 0
}
else {
Write-Host "Diffs were found"
exit 1
}
- task: Yarn@2
displayName: 'Prettier'
inputs:
Arguments: 'prettier'
- task: Yarn@2
displayName: 'Lint'
inputs:
ProjectDirectory: '${{ parameters.PackageDirectory }}'
Arguments: 'lint'
- task: Yarn@2
displayName: 'Test'
inputs:
ProjectDirectory: '${{ parameters.PackageDirectory }}'
Arguments: 'citest'
- script: cd ${{ parameters.PackageDirectory }} && yarn cibuild
displayName: 'Build'
env:
COMMIT_MESSAGE: '$(Build.SourceVersionMessage)'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Generation Task'
inputs:
BuildDropPath: '${{ parameters.PackageDirectory }}/build'
- script: yarn deploy
displayName: 'Deploy Package'
condition: and(succeeded(), eq(variables.isPR, false))
env:
HOME: '$(Agent.BuildDirectory)'
BRANCH: '$(Build.SourceBranchName)'
PULL_REQUEST: '$(isPR)'
COMMIT_MESSAGE: '$(Build.SourceVersionMessage)'
PACKAGE_LOCATION: '${{ parameters.PackageDirectory }}'
PACKAGE_NAME: '${{ parameters.PackageName }}'
SITE_NAME: '${{ parameters.SiteName}}'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_ALPHA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_ALPHA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_BETA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_BETA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STAGING: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STAGING)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK_ALPHA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK_ALPHA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK_BETA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK_BETA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK_STAGING: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_STORYBOOK_STAGING)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER_ALPHA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER_ALPHA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER_BETA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER_BETA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER_STAGING: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_RUNNER_STAGING)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER_ALPHA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER_ALPHA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER_BETA: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER_BETA)'
DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER_STAGING: '$(DEPLOYMENT_PASSWORD_SCRIPT_LAB_REACT_SERVER_STAGING)'