You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: umbraco-cloud/set-up/project-settings/umbraco-cicd/samplecicdpipeline/azure-devops.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,7 +210,7 @@ If you add Build and Test stages after `cloudSyncStage` make sure that you check
210
210
211
211
### Cloud-sync
212
212
213
-
The `cloud-sync.yml` shows how you can sync your Azure DevOps repository with the left-most environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
213
+
The `cloud-sync.yml` shows how you can sync your Azure DevOps repository with the targeted environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
214
214
215
215
If you don't want the pipeline to commit back to the triggering branch, this is where you need to change the pipeline.
216
216
@@ -223,6 +223,8 @@ There are a couple of things here to be aware of:
223
223
* The sample is overwriting the `.gitignore` file with `cloud.gitignore`. This is a way to accommodate your gitignore-needs when working locally. For instance you might want to ignore frontend builds, but you want them build and published to cloud.
224
224
* The sample contains a special `cloud.zipignore` file. This is a convenient way to tell the pipeline which files **not** to include when creating the zip package to send to cloud.
225
225
226
+
If you want to customize the artifact take a look at [Artifact Best Practice](../ArtifactBestPractice.md).
227
+
226
228
### Cloud-deployment
227
229
228
230
The `cloud-deployment.yml` shows how you can deploy to a named environment of your Cloud project. The sample shows how to request the deployment and wait for cloud to finish the operation.
Copy file name to clipboardExpand all lines: umbraco-cloud/set-up/project-settings/umbraco-cicd/samplecicdpipeline/github-actions.md
+46-19Lines changed: 46 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,9 @@ The Umbraco CI/CD Team has created a sample pipeline for Azure DevOps.
18
18
19
19
The Scripts are provided as is. This means that the scripts will do the bare minimum for a pipeline that is utilizing the CI/CD flow. 
20
20
21
-
You'll need to adapt and integrate the script to fit your pipelines to gain the ability to do deployments to your Umbraco Cloud projects.
21
+
You'll need to adapt and integrate the script into your own pipelines to gain the ability to do deployments to your Umbraco Cloud projects.
22
22
23
-
The sample includes YAMLfiles and custom Powershell and Bash scripts to interact with the Umbraco Cloud API.
23
+
The sample includes YAML-files and custom Powershell and Bash scripts to interact with the Umbraco Cloud API.
24
24
25
25
You can get the samples for both `Azure DevOps` and `GitHub Actions` from the [GitHub repository](https://github.com/umbraco/Umbraco.Cloud.CICDFlow.Samples).
26
26
{% endhint %}
@@ -62,6 +62,8 @@ Now we can move on to setting up a pipeline.
62
62
63
63
The pipeline needs to know which Umbraco Cloud project to deploy to. In order to do this you will need the `Project ID` and the `API Key`. [This article](./#obtaining-the-project-id-and-api-key) describes how to get those values.
64
64
65
+
You will also need the alias of the environment you want to target. [This article](./#getting-environment-aliases-to-target) described how you can see a list of environments you can target here. Note the environment alias you want to target.
66
+
65
67
* Now go to the repository in GitHub, and click on the Settings section.
66
68
* Expand secrets and variables in the left-hand menu titled `Security` and click on `Actions`.
67
69
@@ -70,8 +72,11 @@ The pipeline needs to know which Umbraco Cloud project to deploy to. In order to
70
72
* Create a `repository secret` called `UMBRACO_CLOUD_API_KEY` with the `API Key` value from the Umbraco Portal.
71
73
* Create another `repository secret` with the name `PROJECT_ID` and the `Project ID` value from the Umbraco Portal.
72
74
75
+
Now go to the **Variables** tab
76
+
* Create a `repository variable` called `TARGET_ENVIRONMENT_ALIAS` and enter the environment alias you selected earlier.
77
+
73
78
{% hint style="info" %}
74
-
If you want to use other names for the secrets, you need to rename the `secrets` variables in each of `main.yml`'s jobs.
79
+
If you want to use other names for the secrets and variables, you need to rename the `secrets` and `with` variables in each of `main.yml`'s jobs.
75
80
76
81
```yaml
77
82
jobs:
@@ -80,14 +85,24 @@ jobs:
80
85
secrets:
81
86
projectId: ${{ secrets.PROJECT_ID }} # change the part inside the curly braces
82
87
umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # change the part inside the curly braces
88
+
with:
89
+
targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} # change the part inside the curly braces
90
+
91
+
cloud-artifact:
92
+
uses: ./.github/workflows/cloud-artifact.yml
93
+
secrets:
94
+
projectId: ${{ secrets.PROJECT_ID }} # change the part inside the curly braces
95
+
umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # change the part inside the curly braces
83
96
84
97
cloud-deployment:
85
98
needs: cloud-sync
86
99
uses: ./.github/workflows/cloud-deployment.yml
87
100
secrets:
88
101
projectId: ${{ secrets.PROJECT_ID }} # change the part inside the curly braces
89
102
umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # change the part inside the curly braces
90
-
```
103
+
with:
104
+
targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} # change the part inside the curly braces
105
+
```
91
106
{% endhint %}
92
107
93
108
Now GitHub is set up with the needed information to be able to run a deployment back to Umbraco Cloud.
@@ -113,6 +128,8 @@ This is how you can grant these permissions:
113
128
While working with the project on your local machine, follow these steps to prepare the pipeline, using the [samples from the repository](https://github.com/umbraco/Umbraco.Cloud.CICDFlow.Samples).
114
129
115
130
{% hint style="info" %}
131
+
TODO fix links
132
+
116
133
Download the provided sample scripts as ZIP from the [GitHub repository](https://github.com/umbraco/Umbraco.Cloud.CICDFlow.Samples/tree/main). Click on "Code" and then choose "Download ZIP". Then unzip it and use those files for the next steps.
117
134
{% endhint %}
118
135
@@ -128,13 +145,13 @@ For a pipeline that uses Powershell scripts you will need the following files:
128
145
* `Get-LatestDeployment.ps1`
129
146
* `Get-ChangesById.ps1`
130
147
* `Apply-Patch.ps1`
131
-
* `New-Deployment.ps1`
132
-
* `Add-DeploymentPackage.ps1`
148
+
* `Add-DeploymentArtifact.ps1`
133
149
* `Start-Deployment.ps1`
134
150
* `Test-DeploymentStatus.ps1`
135
151
* From the `powershell/github` folder
136
152
* `main.yml`
137
153
* `cloud-sync.yml`
154
+
* `cloud-artifact.yml`
138
155
* `cloud-deployment.yml`
139
156
140
157
**Do the following to prepare the pipeline:**
@@ -162,13 +179,13 @@ For a pipeline that uses Bash scripts you will need the following files:
162
179
* `get_latest_deployment.sh`
163
180
* `get_changes_by_id.sh`
164
181
* `apply-patch.sh`
165
-
* `create_deployment.sh`
166
-
* `upload_package.sh`
182
+
* `upload_artifact.sh`
167
183
* `start_deployment.sh`
168
184
* `get_deployment_status.sh`
169
185
* From the `bash/github` folder
170
186
* `main.yml`
171
187
* `cloud-sync.yml`
188
+
* `cloud-artifact.yml`
172
189
* `cloud-deployment.yml`
173
190
174
191
**Do the following to prepare the pipeline:**
@@ -194,7 +211,7 @@ The push will start a new pipeline run.
194
211
195
212
With everything set up, you may want to confirm that Umbraco Cloud reflects the changes you are sending via your pipeline.
196
213
197
-
While working on you project locally, add a new Document type.
214
+
While working on your project locally, add a new Document type.
198
215
199
216
* Commit the change to `main` branch (or `master` if you did not change the branch name) and push to your repository.
200
217
* The pipeline starts to run
@@ -203,36 +220,46 @@ While working on you project locally, add a new Document type.
203
220
204
221
## High level overview of the pipeline components
205
222
206
-
The mentioned scripts are provided as a starting point. It is recommended that you familiarize yourself with the scripts and with documentation related to how to use GitHub Actions.
223
+
The mentioned scripts are provided as a starting point.
224
+
It is recommended that you familiarize yourself with the scripts and with documentation related to how to use GitHub Actions.
207
225
208
226
The scripts demonstrates the following:
209
227
210
-
* How to sync your GitHub repository with the [left-most project environment](../../../../deployment/) in Umbraco Cloud
211
-
* How to deploy changes to the left-most project environment in Umbraco Cloud
228
+
* How to sync your GitHub repository with an environment in Umbraco Cloud via the environment alias
229
+
* How to prepare and upload an artifact that can be used for a deployment
230
+
* How to deploy changes to an environment in Umbraco Cloud, targeted via the environment alias
212
231
213
232
### Main
214
233
215
234
The `main.yml` is the main pipeline, and is the one that will be triggered on a push to `main` branch. You can configure a different trigger behavior in this file.
216
235
217
-
You can add your Build and Test jobs between the `cloud-sync` and `cloud-deployment` jobs. Keep in mind that you do not need to retain the dotnet build artifact for upload later. The `cloud-deployment` job will take care of packaging all your source code and upload to Umbraco Cloud.
236
+
You can add your Build and Test jobs between the `cloud-sync` and `cloud-artifact` jobs. Keep in mind that you do not need to retain the dotnet build artifact for upload later. The `cloud-artifact` job will take care of packaging all your source code and upload to Umbraco Cloud.
218
237
238
+
If you add Build and Test stages after `cloud-sync` make sure that you checkout the updated code in case there were applied a git patch to your repository.
219
239
### Cloud-sync
220
240
221
-
The `cloud-sync.yml` shows how you can sync your GitHub repository with the left-most environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
241
+
The `cloud-sync.yml` shows how you can sync your GitHub repository with the targeted environment of your Cloud project. In this sample, it accepts any change from the API and applies and commits it back to the branch which triggered the pipeline. However the commit does not trigger the pipeline again.
222
242
223
243
If you don't want the pipeline to commit back to the triggering branch, this is where you need to change the pipeline.
224
244
225
-
### Cloud-deployment
245
+
### Cloud-artifact
226
246
227
-
The `cloud-deployment.yml` show how you can deploy your repository to the left-most environment of your Cloud project. The sample shows how to prepare for deployment, request the deployment and wait for cloud to finish.
247
+
The `cloud-artifact.yml` shows how you can prepare and package an artifact and finally upload it to Umbraco Cloud.
228
248
229
249
There are a couple of things here to be aware of:
230
250
231
-
* We are overwriting the `.gitignore` file with `cloud.gitignore`. This is a way to accommodate your gitignore-needs when working locally. For instance you might want to ignore frontend builds, but you want them build and published to cloud.
232
-
* We have a special `cloud.zipignore` file. This is a convenient way to tell the pipeline which files **not** to include when creating the zip package to send to cloud.
251
+
* The sample is overwriting the `.gitignore` file with `cloud.gitignore`. This is a way to accommodate your gitignore-needs when working locally. For instance you might want to ignore frontend builds, but you want them build and published to cloud.
252
+
* The sample contains a special `cloud.zipignore` file. This is a convenient way to tell the pipeline which files **not** to include when creating the zip package to send to cloud.
253
+
254
+
If you want to customize the artifact take a look at [Artifact Best Practice](../ArtifactBestPractice.md).
255
+
256
+
257
+
### Cloud-deployment
258
+
259
+
The `cloud-deployment.yml` shows how you can deploy to a named environment of your Cloud project. The sample shows how to request the deployment and wait for cloud to finish the operation.
233
260
234
261
{% hint style="info" %}
235
-
If you have frontend assets that needs to be build (using tools like npm/yarn or others), you should add the needed steps before `Zip Source Code`. This is to ensure that the fresh frontend assets will be part of the package to be sent to cloud.
262
+
If you have frontend assets that needs to be built (using tools like npm/yarn or others), you should add the needed steps before `cloud-artifact`. This is to ensure that the fresh frontend assets will be part of the package to be sent to Umbraco Cloud.
0 commit comments