.netazuredeploymentgithub-actionsumbraco

Deploying Umbraco web app to Azure from GitHub Repoistory


I've created a simple Umbraco web app with latest Umbraco and .NET 9.

This works fine locally, I'm using Sqlite so it's just a file in a generated data folder.

I want this to persist, so I've specified the DataDirectory environment variable to be C:\home\data - which in azure persists.

However, once deployed the application just won't seem to run, or generate the Sqlite files. The deployment also seems to have put the wwwroot folder within a wwwroot in azures C:\home\site directory.

I've tried to change my git actions a few times but nothing seems to work, it builds and deploys but won't run and generate all the Umbraco files.

Here is my git actions .yaml:

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy ASP.Net Core app to Azure Web App - app

on:
  push:
    branches:
      - master
  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest
    permissions:
      contents: read #This is required for actions/checkout

    steps:
      - uses: actions/checkout@v4

      - name: Set up .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '9.x'

      - name: Build with dotnet
        run: dotnet build --configuration Release

      - name: dotnet publish
        run: dotnet publish -c Release -o "${{env.DOTNET_ROOT}}/myapp"

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v4
        with:
          name: .net-app
          path: ${{env.DOTNET_ROOT}}/myapp

  deploy:
    runs-on: windows-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    permissions:
      id-token: write #This is required for requesting the JWT
      contents: read #This is required for actions/checkout

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v4
        with:
          name: .net-app
      
      - name: Login to Azure
        uses: azure/login@v2
        with:
          client-id: ${{ secret}}
          tenant-id: ${{ secret }}
          subscription-id: ${{ secret }}

      - name: Deploy to Azure Web App
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v3
        with:
          app-name: 'app'
          slot-name: 'Production'
          package: .
      

I've tried changing the dotnet publish to a few different things and even tried a robocopy to flatted the directory and stop the 2 wwwroot folders happening, though, this may be expected in Azure?

I've tried to follow defaults as much as I can, just can't see why this isn't working from github.

When vising the url I get:

enter image description here

Despite everything building and seemingly being there, it just won't run or generate umbraco files.


Solution

  • I decided to just use Umbraco Cloud to host. I've recreated the site on there. The most likely issue was in my views I was referencing content ID's that were only on my local database. I noticed and resolved this in Umbraco Cloud which was cheaper for hosting anyway