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
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy to Azure

on:
workflow_dispatch:
inputs:
appenv:
type: choice
description: Choose the target environment
options:
- dev
- test
- prod

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@main

- name: Log in to Azure
uses: azure/[email protected]
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true

- name: Deploy ARM Template
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
resourceGroupName: ${{ secrets.AZURE_RG }}
template: ./src/InfrastructureAsCode/main.bicep
deployment-name: arm-deployment
parameters: environment=${{ github.event.inputs.appenv }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

.DS_Store
# Local configuration file for developers
src/Application/src/RazorPagesTestSample/config.json
2 changes: 1 addition & 1 deletion src/Application/src/RazorPagesTestSample/Data/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Message

[Required]
[DataType(DataType.Text)]
[StringLength(250, ErrorMessage = "There's a 200 character limit on messages. Please shorten your message.")]
[StringLength(250, ErrorMessage = "There's a 250 character limit on messages. Please shorten your message.")]
public string Text { get; set; }
}
#endregion
Expand Down
13 changes: 9 additions & 4 deletions src/Application/src/RazorPagesTestSample/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,15 @@ public async Task<IActionResult> OnPostAnalyzeMessagesAsync()
return RedirectToPage();
}

public static void WriteToDirectory(ZipArchiveEntry entry, string destDirectory)
{
string destFileName = Path.Combine(destDirectory, entry.FullName);
entry.ExtractToFile(destFileName);
public static void WriteToDirectory(ZipArchiveEntry entry, string destDirectory)
{
string destFileName = Path.GetFullPath(Path.Combine(destDirectory, entry.FullName));
string fullDestDirPath = Path.GetFullPath(destDirectory + Path.DirectorySeparatorChar);
if (!destFileName.StartsWith(fullDestDirPath)) {
throw new System.InvalidOperationException("Entry is outside the target dir: " + destFileName);
}
entry.ExtractToFile(destFileName);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="xunit" Version="2.7.0" />
Expand Down