diff --git a/.github/workflows/communication-api.yml b/.github/workflows/communication-api.yml index 4f4be77..76d7f4a 100644 --- a/.github/workflows/communication-api.yml +++ b/.github/workflows/communication-api.yml @@ -13,9 +13,28 @@ on: - .github/workflows/communication-api.yml jobs: + build: + name: Build & Test .NET projects + runs-on: ubuntu-latest + env: + PROJECT_PATH: src/Communication/Communication.Api/Communication.Api.csproj + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install .NET SDK + uses: actions/setup-dotnet@v3.2.0 + with: + dotnet-version: 8.0.x + + - name: Build .NET project with dependencies + run: |- + dotnet restore $PROJECT_PATH + dotnet build $PROJECT_PATH --no-restore + deploy: name: Deploy Communication API runs-on: ubuntu-latest + needs: [ build ] env: # Google Cloud variables GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} @@ -24,9 +43,6 @@ jobs: REGION: us-central1 LOCATION: us-central1-a - # .NET variables - PROJECT_PATH: src/Communication/Communication.Api/Communication.Api.csproj - # Docker variables IMAGE: communication-api DOCKERFILE_PATH: src/Communication/Communication.Api/Dockerfile @@ -50,16 +66,6 @@ jobs: install_components: "gke-gcloud-auth-plugin" export_default_credentials: true - - name: Install .NET SDK - uses: actions/setup-dotnet@v3.2.0 - with: - dotnet-version: 8.0.x - - - name: Build .NET project with dependencies - run: |- - dotnet restore $PROJECT_PATH - dotnet build $PROJECT_PATH --no-restore - - name: Configure Docker for authentication run: |- gcloud --quiet auth configure-docker $REGION-docker.pkg.dev @@ -68,8 +74,8 @@ jobs: run: |- docker build \ --tag "$REGION-docker.pkg.dev/$GOOGLE_PROJECT/$PROJECT_NAME/$IMAGE:latest" \ - -f $DOCKERFILE_PATH \ --no-cache \ + -f $DOCKERFILE_PATH \ . - name: Push Docker image diff --git a/src/Communication/Communication.Api/Extensions.cs b/src/Communication/Communication.Api/Extensions.cs index 2b6a262..1d04285 100644 --- a/src/Communication/Communication.Api/Extensions.cs +++ b/src/Communication/Communication.Api/Extensions.cs @@ -12,6 +12,7 @@ using MediatR; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.FileProviders; using OpenTelemetry; using OpenTelemetry.Resources; using OpenTelemetry.Trace; @@ -50,7 +51,12 @@ public static WebApplication ConfigurePipeline(this WebApplication app) { app.UseCorrelationId() .UseAppMetrics() - .UseStaticFiles(new StaticFileOptions()) + .UseStaticFiles(new StaticFileOptions + { + FileProvider = new PhysicalFileProvider( + Path.Combine(app.Environment.ContentRootPath, "EmailTemplates")), + RequestPath = "/EmailTemplates" + }) .UseRouting() .UseEndpoints(endpoints => {