diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 2a4689ac..34fe9f23 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -23,12 +23,22 @@ trigger:
- main
variables:
+#-if false
+- name: IsReleaseBranch
+ value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
+#-endif
- template: build/variables.yml
stages:
+- stage: Commit_Validation
+ dependsOn: []
+ jobs:
+ - template: build/stage-commit-validation.yaml
+
#-if false
# This special if is used to remove those Dotnet_New stages for generated application.
- stage: Dotnet_New_GeneratedApp
+ dependsOn: Commit_Validation
jobs:
- template: .template.config/build/stage-donetnew.yaml
@@ -49,7 +59,7 @@ stages:
iosVariableGroup: 'ApplicationTemplate.Distribution.Internal.iOS'
- stage: Publish_Template_Package
- condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
+ condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'), eq(variables['IsReleaseBranch'], 'true'))
dependsOn:
- Build_Staging_GeneratedApp
- Build_Staging
@@ -58,9 +68,7 @@ stages:
#-endif
- stage: Build_Staging
-#-if false
- dependsOn: []
-#-endif
+ dependsOn: Commit_Validation
jobs:
- template: build/stage-build.yml
parameters:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5833bec3..1654e568 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
Prefix your items with `(Template)` if the change is about the template and not the resulting application.
+## 3.6.X
+- Added conventional commit validation stage `stage-build.yml`
+
## 3.5.X
- Bump Uno packages to 5.2.121 to fix a crash on iOS.
+- Ensure NV.Template.Mobile nuget is only deployed from the main branch.
+- Updated `System.Text.Json` to resolve security vulnerabilities.
+- Remove UWP references in Diagnostics.md
+- Updated `Refit` package to 8.0.0 to address security advisory.
+- Updated `MallardMessageHandlers` package to 2.0.0.
## 3.4.X
- Added a kill switch feature to the app.
diff --git a/build/stage-commit-validation.yaml b/build/stage-commit-validation.yaml
new file mode 100644
index 00000000..7bba2f7e
--- /dev/null
+++ b/build/stage-commit-validation.yaml
@@ -0,0 +1,7 @@
+# This stage is responsible for running the template to validate the commits of the PR
+jobs:
+ - job: OnWindows_ValidateCommits
+ pool:
+ vmImage : $(windowsHostedAgentImage)
+ steps:
+ - template: templates/validate-commits.yaml
\ No newline at end of file
diff --git a/build/templates/validate-commits.yaml b/build/templates/validate-commits.yaml
new file mode 100644
index 00000000..dd7f6b5b
--- /dev/null
+++ b/build/templates/validate-commits.yaml
@@ -0,0 +1,46 @@
+# This template is used to validate that the commit messages follow the Conventional Commits specification (https://www.conventionalcommits.org/en/v1.0.0/).
+# Consider placing this at the beginning of the build pipeline to ensure that the commits are valid before proceeding with longer build steps.
+steps:
+ - task: PowerShell@2
+ condition: eq(variables['Build.Reason'], 'PullRequest')
+ inputs:
+ targetType: 'inline'
+ script: |
+ # Pre-Validation Logging
+ Write-Host "Starting PR Validation..."
+ Write-Host "Source Branch: $(System.PullRequest.SourceBranch)"
+ Write-Host "Target Branch: $(System.PullRequest.TargetBranch)"
+ Write-Host "Pull Request ID: $(System.PullRequest.PullRequestId)"
+ write-Host "Repository: $(Build.Repository.Name)"
+ Write-Host "Build.SourceBranch: $(Build.SourceBranch)"
+
+ # Fetch commit range
+ Write-Host "Retrieving commits..."
+ git fetch origin
+ Write-Host "Commit Range: origin/$(System.PullRequest.TargetBranch)..origin/$(System.PullRequest.SourceBranch)"
+ $commits = git log origin/$(System.PullRequest.TargetBranch)..origin/$(System.PullRequest.SourceBranch) --pretty=format:"%H %B"
+ $commitCount = ($commits | Measure-Object).Count
+ Write-Host "Commits found: $commitCount"
+
+ # Regex pattern for Conventional Commits
+ $pattern = '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\.\-]+\))?(!)?: ([\w ])+([\s\S]*)|^(Merged PR \d+: .+)|^(Merge pull request #/d+ from .+)|^(Merge branch .+)'
+ Write-Host "Regular Expression: $pattern"
+
+ # Validate each commit message
+ $invalidCommits = @()
+ foreach ($commit in $commits -split "`n") {
+ $commitMessage = $commit.Substring($commit.IndexOf(" ") + 1)
+ Write-Host "Validating commit: $commitMessage"
+
+ if ($commitMessage -notmatch $pattern) {
+ $invalidCommits += $commitMessage
+ }
+ }
+
+ if($invalidCommits.count -gt 0) {
+ Write-Error "The following commit messages do no follow the Conventional Commits standard: `n$($invalidCommits -join "`n")"
+ exit 1
+ } else {
+ Write-Host "All commit messages are valid."
+ }
+ displayName: 'Validate Commit Messages'
\ No newline at end of file
diff --git a/doc/Diagnostics.md b/doc/Diagnostics.md
index 2db24bfe..f423bce1 100644
--- a/doc/Diagnostics.md
+++ b/doc/Diagnostics.md
@@ -38,7 +38,7 @@ The page also allows you to manually set some configuration values.
It also has various diagnostics utilities such as the following.
- Send information via email (including log files as attachements).
- Throw exceptions from various threads (to test the error handling or crash reporting).
-- Open the settings folder where the settings files can be found (UWP only).
+- Open the settings folder where the settings files can be found (WinUI only).
## Http Debugger
@@ -52,7 +52,7 @@ Check the following for more details.
- [`IHttpDebuggerService`](..\src\app\ApplicationTemplate.Access\Framework\HttpDebugger\IHttpDebuggerService.cs)
- [`HttpDebuggerHandler`](..\src\app\ApplicationTemplate.Access\Framework\HttpDebugger\HttpDebuggerHandler.cs)
- [`HttpDebuggerViewModel`](..\src\app\ApplicationTemplate.Presentation\ViewModels\Diagnostics\HttpDebugger\HttpDebuggerViewModel.cs)
-- [`HttpDebuggerView`](..\src\app\ApplicationTemplate.UWP\Views\Content\Diagnostics\HttpDebuggerView.xaml)
+- [`HttpDebuggerView`](..\src\app\ApplicationTemplate.Shared.Views\Content\Diagnostics\HttpDebuggerView.xaml)
## Configuration Debugger
diff --git a/src/app/ApplicationTemplate.Access/ApplicationTemplate.Access.csproj b/src/app/ApplicationTemplate.Access/ApplicationTemplate.Access.csproj
index 04bd5ee4..308a6373 100644
--- a/src/app/ApplicationTemplate.Access/ApplicationTemplate.Access.csproj
+++ b/src/app/ApplicationTemplate.Access/ApplicationTemplate.Access.csproj
@@ -21,10 +21,10 @@
-
+
-
-
+
+