Skip to content

Commit

Permalink
Add Release Gate update code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Jan 4, 2024
1 parent 4e0f2ec commit bc74b40
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ dotnet_diagnostic.SA1006.severity = error
dotnet_diagnostic.SA1007.severity = error
dotnet_diagnostic.SA1008.severity = error
dotnet_diagnostic.SA1009.severity = error
dotnet_diagnostic.SA1010.severity = error
dotnet_diagnostic.SA1010.severity = none
dotnet_diagnostic.SA1011.severity = error
dotnet_diagnostic.SA1012.severity = error
dotnet_diagnostic.SA1013.severity = error
Expand Down
30 changes: 8 additions & 22 deletions .github/workflows/BuildOnly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,16 @@ name: Localisation.WPF CI-BuildOnly

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches-ignore:
- main

jobs:
build-and-release:

runs-on: windows-2022

windows-latest:
name: windows-latest
runs-on: windows-latest
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Get Current Visual Studio Information
shell: bash
run: |
dotnet tool update -g dotnet-vs
echo "## About RELEASE ##"
vs where release
- name: Update Visual Studio Latest Release
shell: bash
run: |
echo "## Update RELEASE ##"
vs update release Enterprise
vs modify release Enterprise +mobile +desktop +uwp +web
echo "## About RELEASE Updated ##"
vs where release

- name: Checkout
uses: actions/checkout@v3
Expand All @@ -39,6 +24,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1.3
Expand Down
41 changes: 21 additions & 20 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,20 @@ name: Localisation.WPF CI-Build Release

on:
push:
branches: [ "main" ]
branches:
- main

jobs:
build-and-release:

runs-on: windows-2022
windows-latest:
name: windows-latest
runs-on: windows-latest

permissions: write-all
environment:
name: release
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Get Current Visual Studio Information
shell: bash
run: |
dotnet tool update -g dotnet-vs
echo "## About RELEASE ##"
vs where release
- name: Update Visual Studio Latest Release
shell: bash
run: |
echo "## Update RELEASE ##"
vs update release Enterprise
vs modify release Enterprise +mobile +desktop +uwp +web
echo "## About RELEASE Updated ##"
vs where release

- name: Checkout
uses: actions/checkout@v3
Expand All @@ -38,6 +28,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1.3
Expand All @@ -64,11 +55,21 @@ jobs:
with:
name: nuget
path: '**/*.nupkg'

- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: Create Release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.nbgv.outputs.SemVer2 }}
release_name: ${{ steps.nbgv.outputs.SemVer2 }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Configurations>Debug;Release;PreRelease</Configurations>
<PackageReleaseNotes>Compatability with Net 6 / 7 and net462</PackageReleaseNotes>
<PackageReleaseNotes>Compatability with Net 6/7/8 and net462</PackageReleaseNotes>
<PackageTags>Localisation;WPF;UserControl;net</PackageTags>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
Expand Down
6 changes: 1 addition & 5 deletions Version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.1",
"version": "0.5",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/main$"
Expand All @@ -14,9 +14,5 @@
"buildNumber": {
"enabled": false
}
},
"release": {
"versionIncrement": "build",
"firstUnstableTag": "alpha"
}
}
9 changes: 9 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"version": "8.0.10",
"rollForward": "latestMinor"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.44"
}
}
5 changes: 1 addition & 4 deletions src/Localisation.WPF.TestApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public partial class MainWindow : Window
/// <summary>
/// Initializes a new instance of the <see cref="MainWindow"/> class.
/// </summary>
public MainWindow()
{
InitializeComponent();
}
public MainWindow() => InitializeComponent();
}
}
2 changes: 1 addition & 1 deletion src/Localisation.WPF/Localisation/CultureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace CP.Localisation;
/// </remarks>
public static class CultureManager
{
private static readonly ISubject<Unit> _uICultureChangedSubject = new Subject<Unit>();
private static readonly Subject<Unit> _uICultureChangedSubject = new();
private static CultureSelectWindow? _cultureSelectWindow;
private static NotifyIcon? _notifyIcon;
private static IntPtr _notifyIconHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public bool IsTargetAlive
/// For normal elements their will be a single target. For templates their may be zero or
/// more targets.
/// </remarks>
protected List<WeakReference> TargetObjects { get; } = new();
protected List<WeakReference> TargetObjects { get; } = [];

/// <summary>
/// Gets return the Target Property the extension is associated with.
Expand Down
31 changes: 12 additions & 19 deletions src/Localisation.WPF/Localisation/MarkupExtensionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,26 @@ namespace CP.Localisation;
/// This class provides a single point for updating all markup targets that use the given Markup
/// Extension managed by this class.
/// </remarks>
public class MarkupExtensionManager
/// <remarks>
/// Initializes a new instance of the <see cref="MarkupExtensionManager"/> class.
/// Create a new instance of the manager.
/// </remarks>
/// <param name="cleanupInterval">
/// The interval at which to cleanup and remove extensions associated with garbage collected
/// targets. This specifies the number of new Markup Extensions that are created before a
/// cleanup is triggered.
/// </param>
public class MarkupExtensionManager(int cleanupInterval)
{
/// <summary>
/// The interval at which to cleanup and remove extensions.
/// </summary>
private readonly int _cleanupInterval = 40;

/// <summary>
/// The number of extensions added since the last cleanup.
/// </summary>
private int _cleanupCount;

/// <summary>
/// Initializes a new instance of the <see cref="MarkupExtensionManager"/> class.
/// Create a new instance of the manager.
/// </summary>
/// <param name="cleanupInterval">
/// The interval at which to cleanup and remove extensions associated with garbage collected
/// targets. This specifies the number of new Markup Extensions that are created before a
/// cleanup is triggered.
/// </param>
public MarkupExtensionManager(int cleanupInterval) => _cleanupInterval = cleanupInterval;

/// <summary>
/// Gets return a list of the currently active extensions.
/// </summary>
public List<ManagedMarkupExtension> ActiveExtensions { get; private set; } = new();
public List<ManagedMarkupExtension> ActiveExtensions { get; private set; } = [];

/// <summary>
/// Cleanup references to extensions for targets which have been garbage collected.
Expand Down Expand Up @@ -85,7 +78,7 @@ internal void RegisterExtension(ManagedMarkupExtension extension)
{
// Cleanup extensions for target objects which have been garbage collected for
// performance only do this periodically
if (_cleanupCount > _cleanupInterval)
if (_cleanupCount > cleanupInterval)
{
CleanupInactiveExtensions();
_cleanupCount = 0;
Expand Down
14 changes: 4 additions & 10 deletions src/Localisation.WPF/Localisation/ResxExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class ResxExtension : ManagedMarkupExtension
/// <summary>
/// Cached resource managers.
/// </summary>
private static readonly Dictionary<string, WeakReference> _resourceManagers = new();
private static readonly Dictionary<string, WeakReference> _resourceManagers = [];

/// <summary>
/// The binding (if any) used to store the binding properties for the extension.
Expand Down Expand Up @@ -100,7 +100,7 @@ static ResxExtension()
// switching of language
if (AppDomain.CurrentDomain.FriendlyName == "XDesProc.exe")
{
_assemblyProbingPaths = new List<string>();
_assemblyProbingPaths = [];

// check the registry first for a defined assembly path - use OpenBaseKey to avoid
// Wow64 redirection
Expand Down Expand Up @@ -380,7 +380,7 @@ public bool BindsDirectlyToSource
/// cref="MultiBinding"/> eg If a Resx has two child elements then you.
/// </remarks>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Collection<ResxExtension> Children { get; } = new();
public Collection<ResxExtension> Children { get; } = [];

/// <summary>
/// Gets or sets the default value to use if the resource can't be found.
Expand Down Expand Up @@ -676,13 +676,7 @@ private static bool HasEmbeddedResx(Assembly assembly, string? resxName)
{
var resources = assembly.GetManifestResourceNames();
var searchName = resxName!.ToLower() + ".resources";
foreach (var resource in resources)
{
if (resource.ToLower() == searchName)
{
return true;
}
}
return resources.Any(resource => resource.Equals(searchName, StringComparison.CurrentCultureIgnoreCase));
}
catch
{
Expand Down

0 comments on commit bc74b40

Please sign in to comment.