-
Notifications
You must be signed in to change notification settings - Fork 388
Expand file tree
/
Copy pathDeployWorkflow.ts
More file actions
177 lines (175 loc) · 3.89 KB
/
DeployWorkflow.ts
File metadata and controls
177 lines (175 loc) · 3.89 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import { AzureDevOpsPipeline } from "./project-azuredevops-pipeline-model";
import { GitHubWorkflow } from "./project-github-workflow-model";
export const workflow: GitHubWorkflow = {
name: "Deploy Solution {{ name }}",
on: {
push: {
branches: [
"main"
]
}
},
jobs: {
"build-and-deploy": {
"runs-on": "ubuntu-latest",
env: {
NodeVersion: ""
},
steps: [
{
name: "Checkout",
uses: "actions/checkout@v4"
},
{
name: "Use Node.js",
uses: "actions/setup-node@v4",
with: {
"node-version": "${{ env.NodeVersion }}"
}
},
{
name: "Run npm ci",
run: "npm ci"
},
{
name: "Bundle & Package",
run: "gulp bundle --ship\ngulp package-solution --ship\n"
},
{
name: "CLI for Microsoft 365 Login",
uses: "pnp/[email protected]",
with: {
"CERTIFICATE_ENCODED": "${{ secrets.CERTIFICATE_ENCODED }}",
"CERTIFICATE_PASSWORD": "${{ secrets.CERTIFICATE_PASSWORD }}",
"APP_ID": "${{ secrets.APP_ID }}",
"TENANT": "${{ secrets.TENANT_ID }}"
}
},
{
name: "CLI for Microsoft 365 Deploy App",
uses: "pnp/[email protected]",
with: {
"APP_FILE_PATH": "sharepoint/solution/{{ solutionName }}.sppkg",
"SKIP_FEATURE_DEPLOYMENT": false,
"OVERWRITE": true
}
}
]
}
}
};
export const pipeline: AzureDevOpsPipeline = {
name: "Deploy Solution",
trigger: {
branches: {
include: [
"main"
]
}
},
pool: {
vmImage: "ubuntu-latest"
},
variables: [
{
name: "CertificateBase64Encoded",
value: ""
},
{
name: "CertificateSecureFileId",
value: ""
},
{
name: "CertificatePassword",
value: ""
},
{
name: "EntraAppId",
value: ""
},
{
name: "UserName",
value: ""
},
{
name: "Password",
value: ""
},
{
name: "TenantId",
value: ""
},
{
name: "SharePointBaseUrl",
value: ""
},
{
name: "PackageName",
value: ""
},
{
name: "SiteAppCatalogUrl",
value: ""
},
{
name: "NodeVersion",
value: ""
}
],
stages: [
{
stage: "Build_and_Deploy",
jobs: [
{
job: "Build_and_Deploy",
steps: [
{
task: "NodeTool@0",
displayName: "Use Node.js",
inputs: {
versionSpec: "$(NodeVersion)"
}
},
{
task: "Npm@1",
displayName: "Run npm install",
inputs: {
command: "install"
}
},
{
task: "Gulp@0",
displayName: "Gulp bundle",
inputs: {
gulpFile: "./gulpfile.js",
targets: "bundle",
arguments: "--ship"
}
},
{
task: "Gulp@0",
displayName: "Gulp package",
inputs: {
targets: "package-solution",
arguments: "--ship"
}
},
{
task: "Npm@1",
displayName: "Install CLI for Microsoft 365",
inputs: {
command: "custom",
verbose: false,
customCommand: "install -g @pnp/cli-microsoft365"
}
},
{
script: "\n{{login}} \nm365 spo set --url '$(SharePointBaseUrl)' \n{{addApp}} \n{{deploy}}\n",
displayName: "CLI for Microsoft 365 Deploy App"
}
]
}
]
}
]
};