Skip to content

How can I deploy from GitHub Actions

Automatically deploy your projects to UmbHost.net with Web Deploy using this GitHub action.

This action utilizes Microsoft’s own Web Deploy 3.0+ executable, which you can read everything about here. Further documentation of the rules and parameters can also be seen here.

Place the following in your action /.github/workflows/main.yml

- name: Deploy to UmbHost
uses: UmbHost/umbhost-web-deploy-composite-action@1.0.0
with:
website-name: ${{ secrets.WEBSITE_NAME }}
server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }}
server-username: ${{ secrets.USERNAME }}
server-password: ${{ secrets.PASSWORD }}
source-path: '_build'
source-paramFile: 'Umbraco.Web.SetParameters.xml'
  • Access to the SolidCP account for the hosting package, to download the WebDeploy publishing profile.
  1. Locate the repository you want to automate UmbHost web deployment in.
  2. Select the Actions tab.
  3. Select Set up a workflow yourself.
  4. Copy paste one of the examples into your .yml workflow file and commit the file.
  5. All the examples takes advantage of Secrets, so make sure you have added the required secrets to your repository. Instructions on this can be found in the settings section.
  6. Once you have added your secrets, your new workflow should be running on every push to the branch.

These settings can be either be added directly to your .yml config file or referenced from your GitHub repository Secrets. I strongly recommend storing any private values like server-username and server-password in Secrets, regardless of if the repository is private or not.

To add a secret to your repository go to the Settings tab, followed by Secrets. Here you can add your secrets and reference to them in your .yml file.

You can find the access credentials for WebDeploy by accessing your SolidCP account -> Web Sites -> WEBSITENAME -> Web Publishing -> if you have previously set a password click Download Publishing Profile for this web site and open the downloaded file with Notepad, if you have not previously set a password or you cannot see the Download Publishing Profile for this web site button, enter a Password and Confirmation password and then click Enable, and then you will be able to click the Download Publishing Profile for this web site button

SettingRequiredExampleDefault ValueDescription
website-nameYesexample.com Website name as found in SolidCP
server-computer-nameYeshttps://webdeploy.umbhost.net:8172 or https://webdeploy.us.umbhost.net:8172 Computer name, including the port
server-usernameYesusername Your UmbHost Web Publishing username
server-passwordYespassword Your UmbHost Web Publishing password
source-fileNameYesUmbraco.Web.zipUmbraco.Web.zipThe location of the SetParameters.xml file
source-pathNo_build_buildThe source directory for payload
source-paramFileNo_build The location of the SetParameters.xml file
name: Build, publish and deploy project to UmbHost
on:
push:
branches: [ main ]
env:
SolutionName: ${{ secrets.SOLUTION_NAME }}
BuildPlatform: Any CPU
BuildConfiguration: Release
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3.0.0
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
with:
nuget-version: 5.5.0
- name: Create Build Directory
run: mkdir _build
- name: Restore Packages
run: nuget restore ${{env.SolutionName}}
- name: Build Solution
run: |
msbuild.exe ${{env.SolutionName}} /nologo /nr:false /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:DeleteExistingFiles=True /p:SkipInvalidConfigurations=true /p:IncludeSetAclProviderOnDestination=False /p:AutoParameterizationWebConfigConnectionStrings=False /p:platform="${{env.BuildPlatform}}" /p:configuration="${{env.BuildConfiguration}}" /p:PackageLocation="../_build"
- name: Deploy to UmbHost
uses: UmbHost/umbhost-web-deploy-composite-action@1.0.0
with:
website-name: ${{ secrets.WEBSITE_NAME }}
server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }}
server-username: ${{ secrets.USERNAME }}
server-password: ${{ secrets.PASSWORD }}
source-path: '_build'
source-paramFile: 'Umbraco.Web.SetParameters.xml'