Skip to content

Commit 66c5866

Browse files
authored
Merge pull request #12 from datacute/develop
Split nuget release from build workflow.
2 parents 1f3c5ae + ed817f3 commit 66c5866

File tree

6 files changed

+101
-90
lines changed

6 files changed

+101
-90
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
env:
2525
BUILD_CONFIG: 'Release'
26-
SOLUTION: 'EmbeddedResourceProperty.sln'
26+
SOLUTION: '*.sln'
2727

2828
runs-on: ubuntu-latest
2929

@@ -44,56 +44,32 @@ jobs:
4444
- name: Run tests
4545
run: dotnet test --configuration $BUILD_CONFIG --no-restore --no-build --verbosity normal
4646

47+
- name: Pack NuGet packages
48+
run: |
49+
dotnet pack $SOLUTION --configuration $BUILD_CONFIG --no-build --output ./artifacts
50+
echo "=== Packages created ==="
51+
ls -la ./artifacts/
52+
4753
- name: Get tag for current commit
4854
id: get_tag
55+
# Check for tags when triggered by main branch push (with tag) or direct tag push
56+
# Can't use github.ref_name because it's "main" when pushing branch+tag together
4957
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
50-
run: |
51-
TAG=$(git tag --points-at HEAD | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
52-
echo "tag=$TAG" >> $GITHUB_OUTPUT
53-
echo "Found tag: $TAG"
54-
55-
- name: Pack NuGet package
56-
if: steps.get_tag.outputs.tag != ''
57-
run: dotnet pack src/EmbeddedResourcePropertyGenerator/EmbeddedResourcePropertyGenerator.csproj --configuration $BUILD_CONFIG --no-build --output ./artifacts
58-
59-
- name: Publish to NuGet
60-
if: steps.get_tag.outputs.tag != ''
61-
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
58+
uses: olegtarasov/[email protected]
6259

6360
- name: Extract release notes from CHANGELOG.md
6461
if: steps.get_tag.outputs.tag != ''
6562
id: extract_notes
66-
run: |
67-
VERSION="${{ steps.get_tag.outputs.tag }}"
68-
echo "Extracting notes for version: $VERSION"
69-
70-
NOTES=$(awk -v ver="v$VERSION" '
71-
$0 ~ "^## "ver"$" {flag=1; next}
72-
flag && $0 ~ "^## " {flag=0}
73-
flag
74-
' <(sed "s/\r$//" CHANGELOG.md) | awk '!/^Release Date:/')
75-
NOTES=$(echo "$NOTES" | sed '/./,$!d' | tac | sed '/./,$!d' | tac)
76-
77-
if [ -z "$NOTES" ]; then
78-
echo "Did not find notes with 'v' prefix, trying without."
79-
NOTES=$(awk -v ver="$VERSION" '
80-
$0 ~ "^## "ver"$" {flag=1; next}
81-
flag && $0 ~ "^## " {flag=0}
82-
flag
83-
' <(sed "s/\r$//" CHANGELOG.md) | awk '!/^Release Date:/')
84-
NOTES=$(echo "$NOTES" | sed '/./,$!d' | tac | sed '/./,$!d' | tac)
85-
fi
86-
87-
# Set output
88-
echo "notes<<EOF" >> $GITHUB_OUTPUT
89-
echo "$NOTES" >> $GITHUB_OUTPUT
90-
echo "EOF" >> $GITHUB_OUTPUT
63+
uses: mindsers/changelog-reader-action@v2
64+
with:
65+
version: ${{ steps.get_tag.outputs.tag }}
66+
path: ./CHANGELOG.md
9167

9268
- name: Create GitHub Release
9369
if: steps.get_tag.outputs.tag != ''
9470
uses: softprops/action-gh-release@v1
9571
with:
9672
tag_name: ${{ steps.get_tag.outputs.tag }}
97-
body: ${{ steps.extract_notes.outputs.notes }}
73+
body: ${{ steps.extract_notes.outputs.changes }}
9874
env:
9975
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to NuGet
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '8.0.x'
20+
21+
- name: Restore, Build, and Pack
22+
run: |
23+
dotnet restore *.sln
24+
dotnet build *.sln --configuration Release --no-restore
25+
dotnet pack *.sln --configuration Release --no-build --output ./artifacts
26+
27+
- name: Publish to NuGet
28+
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

CHANGELOG.md

Lines changed: 56 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,83 @@
1-
Changelog
2-
---
1+
# Changelog
32

4-
## v1.1.0
5-
Release Date: 2025-06-29
3+
All notable changes to this project will be documented in this file.
64

7-
### Features
8-
- Rewrote the generator pipeline to improve performance, and only regenerate when additional texts are changed (resolves #4)
9-
- Added support for nested classes and generics (resolves #3)
10-
- Made integration easier by automatically including EmbeddedResources as Additional Text Files
11-
- Lowered the minimum version of Microsoft.CodeAnalysis.CSharp required to support older .NET versions
12-
13-
**Full Changelog**: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/1.0.0...1.1.0
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
147

15-
## v1.0.0
16-
Release Date: 2024-10-28
8+
## [Unreleased]
179

18-
### Features
10+
## [[1.1.0]] - 2025-06-29
1911

20-
* First stable release
12+
### Added
13+
- Support for nested classes and generics
14+
- Automatic inclusion of EmbeddedResources as Additional Text Files to make integration easier
2115

22-
## v0.0.1-alpha.6b
23-
Release Date: 2024-09-24
16+
### Changed
17+
- Rewrote the generator pipeline to improve performance and only regenerate when additional texts are changed
18+
- Lowered the minimum version of Microsoft.CodeAnalysis.CSharp required to support older .NET versions
2419

25-
### Fixes
26-
* Corrected the published package (but the new version broke the doc links)
20+
### Fixed
21+
- Resolves issue #4 (performance improvements)
22+
- Resolves issue #3 (nested classes and generics support)
2723

28-
## v0.0.1-alpha.6
29-
Release Date: 2024-09-24
24+
## [[1.0.0]] - 2024-10-28
3025

31-
### Features
26+
### Added
27+
- First stable release
3228

33-
* Removed windows specific paths from tests
34-
* More documentation
29+
## [[0.0.1-alpha.6b]] - 2024-09-24
3530

36-
## v0.0.1-alpha.5
37-
Release Date: 2024-09-22
31+
### Fixed
32+
- Corrected the published package (but the new version broke the doc links)
3833

39-
### Fixes
34+
## [[0.0.1-alpha.6]] - 2024-09-24
4035

41-
* Included doc-comments of the EmbeddedResourceProperties attribute in the package
36+
### Added
37+
- More documentation
4238

43-
## v0.0.1-alpha.4
44-
Release Date: 2024-09-15
39+
### Changed
40+
- Removed windows specific paths from tests
4541

46-
### Features
42+
## [[0.0.1-alpha.5]] - 2024-09-22
4743

48-
* Moved the attribute to its own dll
49-
* Include Read method in each class
50-
* The Read method, backing fields, and resource names are available to the class
44+
### Fixed
45+
- Included doc-comments of the EmbeddedResourceProperties attribute in the package
5146

52-
## v0.0.1-alpha.3
53-
Release Date: 2024-09-14
47+
## [[0.0.1-alpha.4]] - 2024-09-15
5448

55-
### Features
49+
### Added
50+
- Read method in each class
51+
- The Read method, backing fields, and resource names are now available to the class
5652

57-
* Included `EmbeddedResourcePropertyExample` project in github repository
53+
### Changed
54+
- Moved the attribute to its own dll
5855

59-
### Fixes
56+
## [[0.0.1-alpha.3]] - 2024-09-14
6057

61-
* Removing doc duplication
58+
### Added
59+
- Included `EmbeddedResourcePropertyExample` project in github repository
6260

63-
## v0.0.1-alpha.2
64-
Release Date: 2024-09-13
61+
### Fixed
62+
- Removing doc duplication
6563

66-
### Features
64+
## [[0.0.1-alpha.2]] - 2024-09-13
6765

68-
* Add `[Conditional]` attribute to restrict inclusion of the usage of
69-
the `EmbeddedResourcePropertiesAttribute` in the output.
66+
### Added
67+
- `[Conditional]` attribute to restrict inclusion of the usage of the `EmbeddedResourcePropertiesAttribute` in the output
7068

71-
## v0.0.1-alpha
72-
Release Date: 2024-09-09
69+
## [[0.0.1-alpha]] - 2024-09-09
7370

74-
### Features
71+
### Added
72+
- Support for overriding `ReadEmbeddedResourceValue` partial method
7573

76-
* Add support for overriding `ReadEmbeddedResourceValue` partial method
74+
[Unreleased]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/1.1.0...HEAD
75+
[1.1.0]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/1.0.0...1.1.0
76+
[1.0.0]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha.6b...1.0.0
77+
[0.0.1-alpha.6b]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha.6...0.0.1-alpha.6b
78+
[0.0.1-alpha.6]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha.5...0.0.1-alpha.6
79+
[0.0.1-alpha.5]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha.4...0.0.1-alpha.5
80+
[0.0.1-alpha.4]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha.3...0.0.1-alpha.4
81+
[0.0.1-alpha.3]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha.2...0.0.1-alpha.3
82+
[0.0.1-alpha.2]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/compare/0.0.1-alpha...0.0.1-alpha.2
83+
[0.0.1-alpha]: https://github.com/datacute/EmbeddedResourcePropertyGenerator/releases/tag/0.0.1-alpha

EmbeddedResourcePropertyExample/EmbeddedResourcePropertyExample.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<OutputType>Exe</OutputType>
8+
<IsPackable>false</IsPackable>
89
</PropertyGroup>
910

1011
<PropertyGroup>

EmbeddedResourcePropertyGenerator.Attributes/EmbeddedResourcePropertyGenerator.Attributes.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<PropertyGroup>
1313
<GenerateDocumentationFile>true</GenerateDocumentationFile>
14+
<IsPackable>false</IsPackable>
1415
</PropertyGroup>
1516

1617
</Project>

EmbeddedResourcePropertyGenerator.Tests/EmbeddedResourcePropertyGenerator.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<OutputType>Exe</OutputType>
8-
9-
<IsPackable>false</IsPackable>
108
<IsTestProject>true</IsTestProject>
119
</PropertyGroup>
1210

0 commit comments

Comments
 (0)