Skip to content

Commit

Permalink
fix(communication): add email templates to using static files
Browse files Browse the repository at this point in the history
  • Loading branch information
cowienduckie committed Dec 1, 2023
1 parent 97cdf73 commit c23a6bc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/communication-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/Communication/Communication.Api/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 =>
{
Expand Down

0 comments on commit c23a6bc

Please sign in to comment.