Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,24 @@ on:
- main
workflow_dispatch:

env:
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-version: '8.x'
include-prerelease: true

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

- name: dotnet publish
run: dotnet publish ResourceInformationV2 -c Release -r linux-x64 --property:PublishDir=${{env.DOTNET_ROOT}}/myapp
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
Expand All @@ -54,7 +51,6 @@ jobs:
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: itp-app-resource2
package: .
slot-name: staging
app-name: 'wigg-resource-infra-winapp01'
publish-profile: ${{ secrets.AZURE_WEB_PUBLISH_PROFILE_PRODUCTION }}
package: .
57 changes: 57 additions & 0 deletions .github/workflows/wigg-app-staging-resource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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: Staging WIGG Build and deploy ASP.Net Core app to Azure Web App

on:
push:
branches:
- develop
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
include-prerelease: true

- 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 }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'wigg-resource-infra-winapp01'
slot-name: 'staging'
publish-profile: ${{ secrets.AZURE_WEB_PUBLISH_PROFILE_STAGING }}
package: .
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ on:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'ResourceInformationV2.Function' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use

jobs:
build-and-deploy:
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- name: 'Checkout GitHub Action'
Expand All @@ -25,20 +25,18 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
include-prerelease: true

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output -r linux-x64
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'itp-function-resource2'
app-name: 'wigg-resource-infra-funapp01'
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
slot-name: staging
publish-profile: ${{ secrets.AZURE_FUNCTION_PUBLISH_PROFILE_PRODUCTION }}
publish-profile: ${{ secrets.AZURE_FUNCTION_PUBLISH_PROFILE_PRODUCTION }}
43 changes: 43 additions & 0 deletions .github/workflows/wigg-fun-staging-resource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Staging WIGG Build and deploy ASP.Net Core app to Azure Function App

on:
push:
branches:
- develop
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'ResourceInformationV2.Function' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use

jobs:
build-and-deploy:
runs-on: windows-latest

steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'wigg-resource-infra-funapp01'
slot-name: 'staging'
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTION_PUBLISH_PROFILE_STAGING }}
10 changes: 5 additions & 5 deletions ResourceInformationV2.Function/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
options.PropertyNamingPolicy = new JsonNamingPolicyLowerCase();
});
_ = services.ConfigureFunctionsApplicationInsights();
_ = services.AddDbContextFactory<ResourceContext>(options => options.UseSqlServer(hostContext.Configuration["AppConnection"]).EnableSensitiveDataLogging(true));
_ = services.AddDbContextFactory<ResourceContext>(options => options.UseSqlServer(hostContext.Configuration["Values:AppConnection"]).EnableSensitiveDataLogging(true));
_ = services.AddScoped<ResourceRepository>();
_ = services.AddScoped<BulkEditor>();
_ = services.AddScoped<SourceHelper>();
_ = services.AddScoped<FilterHelper>();
_ = services.AddScoped<FilterTranslator>();
_ = services.AddScoped<ApiHelper>();
_ = services.AddScoped(b => new EmailClient(hostContext.Configuration["EmailApiKey"] ?? "", hostContext.Configuration["EmailFromEmail"] ?? "", hostContext.Configuration["EmailServerId"] ?? "", hostContext.Configuration["EmailUrl"] ?? ""));
_ = services.AddScoped(b => new EmailClient(hostContext.Configuration["Values:EmailApiKey"] ?? "", hostContext.Configuration["Values:EmailFromEmail"] ?? "", hostContext.Configuration["Values:EmailServerId"] ?? "", hostContext.Configuration["Values:EmailUrl"] ?? ""));
_ = services.AddScoped<SourceEmailHelper>();
_ = services.AddScoped<LogHelper>();
_ = services.AddSingleton(c => OpenSearchFactory.CreateLowLevelClient(hostContext.Configuration["SearchUrl"], hostContext.Configuration["AccessKey"], hostContext.Configuration["SecretKey"], hostContext.Configuration["Debug"] == "true"));
_ = services.AddSingleton(c => OpenSearchFactory.CreateClient(hostContext.Configuration["SearchUrl"], hostContext.Configuration["AccessKey"], hostContext.Configuration["SecretKey"], true));
_ = services.AddSingleton(c => OpenSearchFactory.CreateLowLevelClient(hostContext.Configuration["Values:SearchUrl"], hostContext.Configuration["Values:AccessKey"], hostContext.Configuration["Values:SecretKey"], hostContext.Configuration["Values:Debug"] == "true"));
_ = services.AddSingleton(c => OpenSearchFactory.CreateClient(hostContext.Configuration["Values:SearchUrl"], hostContext.Configuration["Values:AccessKey"], hostContext.Configuration["Values:SecretKey"], true));
_ = services.AddScoped<ResourceGetter>();
_ = services.AddScoped<PublicationGetter>();
_ = services.AddScoped<NoteGetter>();
Expand All @@ -52,4 +52,4 @@
})
.Build();

host.Run();
host.Run();
10 changes: 6 additions & 4 deletions ResourceInformationV2.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.36105.23
# Visual Studio Version 18
VisualStudioVersion = 18.1.11312.151 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceInformationV2", "ResourceInformationV2\ResourceInformationV2.csproj", "{BB72C320-FC9B-4B8D-AE96-2417A099B41B}"
EndProject
Expand All @@ -19,9 +19,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceInformationV2.Templ
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
ProjectSection(SolutionItems) = preProject
.github\workflows\app_production.yml = .github\workflows\app_production.yml
.github\workflows\fun_production.yml = .github\workflows\fun_production.yml
README.md = README.md
.github\workflows\wigg-app-prod-resource.yml = .github\workflows\wigg-app-prod-resource.yml
.github\workflows\wigg-app-staging-resource.yml = .github\workflows\wigg-app-staging-resource.yml
.github\workflows\wigg-fun-prod-resource.yml = .github\workflows\wigg-fun-prod-resource.yml
.github\workflows\wigg-fun-staging-resource.yml = .github\workflows\wigg-fun-staging-resource.yml
EndProjectSection
EndProject
Global
Expand Down
4 changes: 2 additions & 2 deletions ResourceInformationV2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

builder.Services.AddDbContextFactory<ResourceContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("AppConnection")).EnableSensitiveDataLogging(true));
builder.Services.AddScoped<ResourceRepository>();
builder.Services.AddSingleton(b => OpenSearchFactory.CreateClient(builder.Configuration["SearchUrl"], builder.Configuration["SearchAccessKey"], builder.Configuration["SearchSecretAccessKey"], bool.Parse(builder.Configuration["SearchDebug"] ?? "false")));
builder.Services.AddSingleton(b => OpenSearchFactory.CreateLowLevelClient(builder.Configuration["SearchUrl"], builder.Configuration["SearchAccessKey"], builder.Configuration["SearchSecretAccessKey"], bool.Parse(builder.Configuration["SearchDebug"] ?? "false")));
builder.Services.AddSingleton(b => OpenSearchFactory.CreateClient(builder.Configuration["SearchUrl"], builder.Configuration["AccessKey"], builder.Configuration["SecretKey"], bool.Parse(builder.Configuration["SearchDebug"] ?? "false")));
builder.Services.AddSingleton(b => OpenSearchFactory.CreateLowLevelClient(builder.Configuration["SearchUrl"], builder.Configuration["AccessKey"], builder.Configuration["SecretKey"], bool.Parse(builder.Configuration["SearchDebug"] ?? "false")));
builder.Services.AddScoped<BulkEditor>();
builder.Services.AddScoped<JsonHelper>();
builder.Services.AddSingleton<CacheHolder>();
Expand Down
Loading