Skip to content

Commit 89be17c

Browse files
authored
Release: V2.0.0
Upgraded to latest versions
2 parents 98299d7 + 9876d90 commit 89be17c

File tree

7 files changed

+193
-23
lines changed

7 files changed

+193
-23
lines changed

.github/workflows/deploy.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Deploy
2+
on:
3+
push:
4+
branches: [ master ]
5+
6+
jobs:
7+
test:
8+
runs-on: windows-latest
9+
steps:
10+
- name: Checkout Sources
11+
uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- name: Setup .NET 8
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: 8.0.x
18+
- name: "Build and Test"
19+
run: |
20+
dotnet build
21+
dotnet test
22+
version:
23+
needs: test
24+
runs-on: windows-latest
25+
outputs:
26+
version: ${{ steps.newversion.outputs.version }}
27+
tag: ${{ steps.newversion.outputs.tag }}
28+
steps:
29+
- name: Checkout Sources
30+
uses: actions/checkout@v2
31+
with:
32+
fetch-depth: 0
33+
- name: Set New Version
34+
id: newversion
35+
shell: pwsh
36+
run: |
37+
$currentVersion = git describe --abbrev=0 --tags --match "v[0-9]*.[0-9]*.[0-9]*-Release"
38+
39+
if ($currentVersion) {
40+
$v = $currentVersion.Split('-')[0].TrimStart('v')
41+
Write-Output "RELEASE: New Version: $($v)"
42+
Write-Output "version=$($v)" >> $Env:GITHUB_OUTPUT
43+
Write-Output "tag=$($currentVersion)" >> $Env:GITHUB_OUTPUT
44+
} else {
45+
46+
$currentVersion = git describe --abbrev=0 --tags --match "v[0-9]*.[0-9]*.[0-9]*"
47+
$currentVersion = git describe --match "$($currentVersion)" --long
48+
$versionParts = $currentVersion.Split('-')
49+
$v = $versionParts[0]
50+
$increment = [int]$versionParts[1]
51+
52+
if ($increment -gt 0) {
53+
$increment = 1
54+
}
55+
56+
$vparts = $v.Split('.')
57+
$vparts[2] = "$([int]$vparts[2] + [int]$increment)"
58+
$v = $vparts -join '.'
59+
$v = "$($v)".TrimStart("v")
60+
Write-Output "New Version: $($v)"
61+
Write-Output "version=$($v)" >> $Env:GITHUB_OUTPUT
62+
Write-Output "tag=" >> $Env:GITHUB_OUTPUT
63+
}
64+
prepublish:
65+
needs: [test, version]
66+
runs-on: windows-latest
67+
outputs:
68+
description: ${{ steps.meta.outputs.description }}
69+
changeinfo: ${{ steps.meta.outputs.changeinfo }}
70+
steps:
71+
- name: Checkout Sources
72+
uses: actions/checkout@v2
73+
with:
74+
fetch-depth: 0
75+
- name : Get Meta Data
76+
shell: pwsh
77+
id: meta
78+
run: |
79+
[xml]$xml = get-content "src/Autofac.EasyPropInject.csproj"
80+
$description = $xml.SelectSingleNode("//Description").InnerText;
81+
$changes = $xml.SelectSingleNode("//PackageReleaseNotes").InnerText;
82+
Write-Output "description=$($description.Trim().Replace("`t", '') | ConvertTo-Json)" >> $Env:GITHUB_OUTPUT
83+
Write-Output "changeinfo=$($changes.Trim().Replace("`t", '') | ConvertTo-Json)" >> $Env:GITHUB_OUTPUT
84+
85+
publish:
86+
needs: [test, version, prepublish]
87+
runs-on: windows-latest
88+
steps:
89+
- name: Setup .NET 8
90+
uses: actions/setup-dotnet@v4
91+
with:
92+
dotnet-version: 8.0.x
93+
- name: Checkout Sources
94+
uses: actions/checkout@v2
95+
with:
96+
fetch-depth: 0
97+
- name: Create Package
98+
run: |
99+
dotnet build src/Autofac.EasyPropInject.csproj -c Release -p:AssemblyVersion=${{ needs.version.outputs.version }} -p:PackageVersion=${{ needs.version.outputs.version }}
100+
dotnet pack src/Autofac.EasyPropInject.csproj -c Release -p:AssemblyVersion=${{ needs.version.outputs.version }} -p:PackageVersion=${{ needs.version.outputs.version }} --output nget_pkg
101+
- name: Create Release and Tag
102+
id: create_release
103+
uses: actions/create-release@latest
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
106+
with:
107+
tag_name: v${{ needs.version.outputs.version }}
108+
release_name: Release v${{ needs.version.outputs.version }}
109+
body: |
110+
# Release Info Version ${{ needs.version.outputs.version }}
111+
## Info
112+
${{fromJSON(needs.prepublish.outputs.description)}}
113+
## Changes in v${{ needs.version.outputs.version }}
114+
${{fromJSON(needs.prepublish.outputs.changeinfo)}}
115+
draft: false
116+
prerelease: false
117+
- name: Delete Release Tag
118+
if: ${{needs.version.outputs.tag}}
119+
uses: dev-drprasad/delete-tag-and-release@v1.0
120+
with:
121+
tag_name: ${{needs.version.outputs.tag}}
122+
github_token: ${{ secrets.GITHUB_TOKEN }}
123+
delete_release: false
124+
- name: Upload Release Asset Pkg
125+
id: upload-release-asset
126+
uses: actions/upload-release-asset@v1
127+
env:
128+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+
with:
130+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
131+
asset_path: ./nget_pkg/Autofac.EasyPropInject.${{ needs.version.outputs.version }}.nupkg
132+
asset_name: Autofac.EasyPropInject.${{ needs.prepublish.version.version }}.nupkg
133+
asset_content_type: application/zip
134+
- name: Upload Release Asset DLL
135+
id: upload-release-asset2
136+
uses: actions/upload-release-asset@v1
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
with:
140+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
141+
asset_path: src/bin/Release/net8.0/Autofac.EasyPropInject.dll
142+
asset_name: Autofac.EasyPropInject.dll
143+
asset_content_type: application/octet-stream
144+
- name: Publish package to nuget
145+
id: nugetpush
146+
run: dotnet nuget push "nget_pkg/Autofac.EasyPropInject.${{ needs.version.outputs.version }}.nupkg" -k ${{secrets.NUGET_KEY}} -s https://api.nuget.org/v3/index.json
147+
148+
149+

.github/workflows/pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pull Request Check
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
test:
8+
runs-on: windows-latest
9+
steps:
10+
- name: Checkout Sources
11+
uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- name: Setup .NET 68
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: 8.0.x
18+
- name: "Build and Test"
19+
run: |
20+
dotnet build
21+
dotnet test

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44

55
# Important!
6-
Due to breaking changes to Autofac API with version 6.x older Autofac.EasyPropInject Readme can be found in 1.0.x (Autofac <=4>) and 1.1.x (Autofac >=5 < 6>).
7-
master and 1.2.x will show code examples and info only for Autofac >= 6.
6+
Due to new Autofac v.8 Version - older versions stay as they are. Updates only occur to latest version released.
87

98
# Autofac.EasyPropInject
10-
An extension i created to make it possible to to inject properties by attribute, without any other helper libs in .NET Core for [Autofac](https://github.com/autofac/Autofac).
9+
An extension i created to make it possible to to inject properties by attribute, without any other helper libs in .NET Standard for [Autofac](https://github.com/autofac/Autofac).
1110

1211
# Install
1312
## Nuget
@@ -73,6 +72,7 @@ Since the type casting feature new in 1.2.x of EasyPropInject is handy sometimes
7372

7473

7574
# Whats new?
75+
* 2.0.0 - Upgraded to latest Autofac (8.x)
7676
* 1.2.5 - Upgraded to Autofac 6.3.x, Added support for private and protected properties See tests for example (https://github.com/nfMalde/Autofac.EasyPropInject/blob/1.2.x/tests/Autofac.EasyPropInject.Testing/InjectionTests.cs)
7777
* 1.2.4 - Upgraded to Autofac 6.2.x
7878
* 1.2.3 - Upgraded to Autofac 6.1.x

nugetdocs/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
# Important!
7-
Due to breaking changes to Autofac API with version 6.x older Autofac.EasyPropInject Readme can be found in 1.0.x (Autofac <=4>) and 1.1.x (Autofac >=5 < 6>).
8-
master and 1.2.x will show code examples and info only for Autofac >= 6.
7+
Due to new Autofac v.8 Version - older versions stay as they are. Updates only occur to latest version released.
8+
99

1010
# Autofac.EasyPropInject
1111
An extension i created to make it possible to to inject properties by attribute, without any other helper libs in .NET Core for [Autofac](https://github.com/autofac/Autofac).
@@ -74,6 +74,7 @@ Since the type casting feature new in 1.2.x of EasyPropInject is handy sometimes
7474

7575

7676
# Whats new?
77+
* 2.0.0 - Upgraded to latest Autofac (8.x)
7778
* 1.2.5 - Upgraded to Autofac 6.3.x, Added support for private and protected properties See tests for example (https://github.com/nfMalde/Autofac.EasyPropInject/blob/1.2.x/tests/Autofac.EasyPropInject.Testing/InjectionTests.cs)
7879
* 1.2.4 - Upgraded to Autofac 6.2.x
7980
* 1.2.3 - Upgraded to Autofac 6.1.x

src/Autofac.EasyPropInject.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>netstandard2.1</TargetFramework>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
66
<Description>Allows to inject properties of classes by using annotations.</Description>
77
<Authors>Malte Peters</Authors>
@@ -11,14 +11,13 @@
1111
<PackageProjectUrl>https://github.com/nfMalde/Autofac.EasyPropInject</PackageProjectUrl>
1212
<RepositoryUrl>https://github.com/nfMalde/Autofac.EasyPropInject</RepositoryUrl>
1313
<RepositoryType>GIT</RepositoryType>
14-
<PackageReleaseNotes>Upgraded to Autofac 6.3.x
15-
Added support for private and protected properties</PackageReleaseNotes>
16-
<PackageReadmeFile>README.md</PackageReadmeFile>
14+
<PackageReleaseNotes>Upgraded to Autofac 8.x</PackageReleaseNotes>
15+
<PackageReadmeFile>README.md</PackageReadmeFile>
1716

1817
</PropertyGroup>
1918

2019
<ItemGroup>
21-
<PackageReference Include="Autofac" Version="6.3.0" />
20+
<PackageReference Include="Autofac" Version="8.1.1" />
2221
<None Include="..\nugetdocs\README.md" Pack="true" PackagePath="\" />
2322
</ItemGroup>
2423

tests/Autofac.EasyPropInject.Testing/Autofac.EasyPropInject.Testing.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77

@@ -11,11 +11,11 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Autofac" Version="6.3.0" />
15-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
16-
<PackageReference Include="nunit" Version="3.13.2" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
14+
<PackageReference Include="Autofac" Version="8.1.1" />
15+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
16+
<PackageReference Include="nunit" Version="4.2.2" />
17+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

tests/Autofac.EasyPropInject.Testing/InjectionTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Autofac.EasyPropInject.Testing.mocks;
22
using NUnit.Framework;
3-
3+
using Autofac.EasyPropInject;
44
namespace Autofac.EasyPropInject.Testing
55
{
66
/// <summary>
@@ -38,26 +38,26 @@ public void ItShouldInjectPropertiesOfInstanceAndChildInstances()
3838
{
3939
var m1 = this.container.Resolve<IMock1>();
4040

41-
Assert.NotNull(m1.Mock2Property);
42-
Assert.NotNull(m1.Mock2Property.Mock3Property);
43-
Assert.NotNull(m1.Mock2Property.Mock3Property.Mock4ResolvedAsMainType);
41+
Assert.That(m1.Mock2Property != null);
42+
Assert.That(m1.Mock2Property.Mock3Property != null);
43+
Assert.That(m1.Mock2Property.Mock3Property.Mock4ResolvedAsMainType != null);
4444
}
4545

4646
[Test]
4747
public void ItShouldResolvePrivateProperties()
4848
{
4949
var mPrivate = this.container.Resolve<IMockPrivate>();
5050

51-
Assert.NotNull(mPrivate.Mock1Test());
51+
Assert.That(mPrivate.Mock1Test() != null);
5252
}
5353

5454
[Test]
5555
public void ItShouldResolveProtectedProperties()
5656
{
5757
var mPrivate = this.container.Resolve<IMockProtected>();
5858

59-
Assert.NotNull(mPrivate.GetMockPrivate());
60-
Assert.NotNull(mPrivate.GetMockPrivate().Mock1Test());
59+
Assert.That(mPrivate.GetMockPrivate() != null);
60+
Assert.That(mPrivate.GetMockPrivate().Mock1Test() != null);
6161
}
6262
}
6363
}

0 commit comments

Comments
 (0)