GitHub Actions v1
Before setting up the pipeline in GitHub, make sure that the following steps from the Configuring a CI/CD pipeline are done:
Pick a Cloud project
Activate CI/CD Flow
Next, you will need to define your pipeline in YAML and use it to interact with the Umbraco Cloud API.
Please be aware that since this involves using your custom pipeline, any issues that arise will need to be resolved by you.
Import Cloud project repository to GitHub
Go to your repositories in GitHub and click on "New".
Create a new empty repository, and note down the clone URL.
Go to the Umbraco Cloud Portal and clone your cloud project down locally. This article describes how you can find the clone URL.
Now working locally remove the Git Remote called
origin, which points to Umbraco Cloud
git remote remove originOptionally rename branch
mastertomain
# optional step
git branch -m  main
git symbolic-ref HEAD refs/heads/mainAdd a new remote called origin and pointing to the GitHub clone URL and push
git remote add origin https://github.com/{your-organization}/{your-repository}.git
git push -u origin --allNow we can move on to setting up a pipeline.
Set up GitHub repository variables
The pipeline needs to know which Umbraco Cloud project to deploy to. To do this, you need the Project ID and the API Key. The Obtaining the Project ID and API Key section describes how to get these values.
Now go to the repository in GitHub, and click on the Settings section.
Expand secrets and variables in the left-hand menu titled
Securityand click onActions.

Create a
repository secretcalledUMBRACO_CLOUD_API_KEYwith theAPI Keyvalue from the Umbraco Portal.Create another
repository secretwith the namePROJECT_IDand theProject IDvalue from the Umbraco Portal.
Now GitHub is set up with the needed information to be able to run a deployment back to Umbraco Cloud.
Next up it setting up the actual pipeline.
Allow GitHub to commit to your repository
The sample pipelines have a job called cloud-sync. This job is responsible for checking for changes in your Umbraco Cloud project, fetching them, and applying them back to your repository. In order for this to work, you need to give the GITHUB_TOKEN write permissions to the repository during workflow runs.
This is how you can grant these permissions:
Working in your repository on
GitHub, click onSettingsin the top rightIn the left sidebar, click on
Actionsand then onGeneralScroll down to the
Workflow permissionssectionsSelect the
Read and write permissionsClick save

Set up the GitHub Actions pipeline
While working with the project on your local machine, follow these steps to prepare the pipeline, using the samples from the repository.
Select your preferred scripting language:
For a pipeline that uses Powershell scripts you will need the following files:
From the root folder
cloud.zipignore
From the
powershellfolderGet-LatestDeployment.ps1Get-ChangesById.ps1Apply-Patch.ps1New-Deployment.ps1Add-DeploymentPackage.ps1Start-Deployment.ps1Test-DeploymentStatus.ps1
From the
powershell/githubfoldermain.ymlcloud-sync.ymlcloud-deployment.yml
Do the following to prepare the pipeline:
Copy the
cloud.zipignorefile to the root of your repositoryMake a copy of the
.gitignorefrom your repository and call the copycloud.gitignoreBoth files should be in the root of your repository
In the bottom of the
.gitignorefile add the line**/git-patch.diff
Also in the root, create a folder called
.githubInside
.githubcreate two additional foldersworkflowspowershell
Copy the 3 YAML files from the
githubfolder into theworkflowsfolderCopy the Powershell scripts from the
powershellfolder to thepowershellfolderNote: If you have not changed the branch to
main, then in themain.ymlfile change the branch frommaintomaster.Commit the all changes, and push to GitHub
For a pipeline that uses Bash scripts you will need the following files:
From the root folder
cloud.zipignore
From the
bashfolderget_latest_deployment.shget_changes_by_id.shapply-patch.shcreate_deployment.shupload_package.shstart_deployment.shget_deployment_status.sh
From the
bash/githubfoldermain.ymlcloud-sync.ymlcloud-deployment.yml
Do the following to prepare the pipeline:
Copy the
cloud.zipignorefile to the root of your repositoryMake a copy of the
.gitignorefrom your repository and call the copycloud.gitignoreBoth files should be in the root of your repository
In the bottom of the
.gitignorefile add the line**/git-patch.diff
Also in the root, create a folder called
.githubInside
.githubcreate two additional foldersworkflowsscripts
Copy the 3 YAML files from the
githubfolder into theworkflowsfolderCopy the Bash scripts from the
bashfolder to thescriptsfolderNote: If you have not changed the branch to
main, then in themain.ymlfile change the branch frommaintomaster.Commit the all changes, and push to GitHub
The push will start a new pipeline run.
Optional: Test the pipeline
With everything set up, you may want to confirm that Umbraco Cloud reflects the changes you are sending via your pipeline.
While working on you project locally, add a new Document type.
Commit the change to
mainbranch (ormasterif you did not change the branch name) and push to your repository.The pipeline starts to run
Once the pipeline is done log into Backoffice on your left-most environment in Umbraco Cloud
Go to the Settings section and see that your new Document type has been deployed
High level overview of the pipeline components
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.
The scripts demonstrates the following:
How to sync your GitHub repository with the left-most project environment in Umbraco Cloud
How to deploy changes to the left-most project environment in Umbraco Cloud
Main
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.
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.
Cloud-sync
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.
If you don't want the pipeline to commit back to the triggering branch, this is where you need to change the pipeline.
Cloud-deployment
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.
There are a couple of things here to be aware of:
We are overwriting the
.gitignorefile withcloud.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.We have a special
cloud.zipignorefile. This is a convenient way to tell the pipeline which files not to include when creating the zip package to send to cloud.
Further information
Last updated
Was this helpful?