Skip to content

Commit 3339709

Browse files
authored
add github workflow for nuget publishing
1 parent 20d672b commit 3339709

File tree

5 files changed

+100
-7
lines changed

5 files changed

+100
-7
lines changed

.github/workflows/publish.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
12+
steps:
13+
- name: Extract version from tag
14+
uses: nowsprinting/check-version-format-action@v3
15+
id: version
16+
with:
17+
prefix: 'v'
18+
19+
- name: Invalid version tag
20+
if: steps.version.outputs.is_valid != 'true'
21+
run: |
22+
echo "Version tag format invalid: ${{ steps.version.outputs.full }}"
23+
exit 1
24+
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0 # Mandatory to use exact version from tag action
29+
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v3
32+
with:
33+
dotnet-version: 8.0.x
34+
35+
- name: Check version
36+
# assert version match with project version so only pre-release label can be changed based on release tag
37+
run: dotnet build -t:CheckVersion -c Release -p BuildVersion="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
38+
39+
- name: Set version info
40+
run: |
41+
$VersionPrefix="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
42+
$VersionSuffix="${{ steps.version.outputs.prerelease }}"
43+
$IsStable="${{ steps.version.outputs.is_stable }}"
44+
if ( -not $VersionSuffix ) {
45+
$Version=$VersionPrefix
46+
} else {
47+
$Version="$VersionPrefix-$VersionSuffix"
48+
}
49+
echo "VersionPrefix=$VersionPrefix" >> $Env:GITHUB_ENV
50+
echo "VersionSuffix=$VersionSuffix" >> $Env:GITHUB_ENV
51+
echo "Version=$Version" >> $Env:GITHUB_ENV
52+
echo "IsStable=$IsStable" >> $Env:GITHUB_ENV
53+
echo "Create release: v$Version"
54+
55+
- name: Build
56+
run: dotnet test Aqua.sln -c Release /bl
57+
58+
- name: Upload build log
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: msbuild_log
62+
path: msbuild.binlog
63+
if-no-files-found: error
64+
65+
- name: Upload packages
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: nuget_packages
69+
path: artifacts
70+
if-no-files-found: error
71+
72+
- name: Publish packages
73+
env:
74+
MYGET_AUTH_TOKEN: ${{ secrets.MYGET_AUTH_TOKEN }}
75+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}
76+
run: |
77+
dotnet nuget push artifacts\*.nupkg -k "$env:MYGET_AUTH_TOKEN" -s https://www.myget.org/F/aqua/api/v3/index.json
78+
dotnet nuget push artifacts\*.nupkg -k "$env:NUGET_AUTH_TOKEN" -s https://api.nuget.org/v3/index.json

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ nuget.exe
2828
*.db
2929
.vs/
3030
config.test.json
31+
*.binlog
3132
*.log
3233
/.build/
3334
.testPublish/

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<MajorVersion>5</MajorVersion>
66
<MinorVersion>4</MinorVersion>
77
<PatchVersion>0</PatchVersion>
8-
<PreReleaseLabel>alpha-001</PreReleaseLabel>
8+
<PreReleaseLabel>dev</PreReleaseLabel>
99
</PropertyGroup>
1010

1111
<PropertyGroup>

Directory.Build.targets

+5
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@
88
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
99
</Exec>
1010
</Target>
11+
<Target Name="CheckVersion">
12+
<Message Text="Check Version: '$(BuildVersion)' == '$(VersionPrefix)' [$(MSBuildProjectFile)]" Importance="high" />
13+
<Error Condition=" '$(BuildVersion)' == '' " Text="Build version must not be emty" />
14+
<Error Condition=" '$(BuildVersion)' != '$(VersionPrefix)' " Text="Build version '$(BuildVersion)' does not match project version '$(VersionPrefix)'" />
15+
</Target>
1116
</Project>

README.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# aqua-core
2+
3+
[![Github Workflow][pub-badge]][pub-link]
4+
25
| branch | AppVeyor | Travis CI | Codecov.io | Codacy | CodeFactor | License |
36
| --- | --- | --- | --- | --- | --- | --- |
47
| `main` | [![AppVeyor Build Status][1]][2] | [![Travis Build Status][3]][4] | [![codecov][5]][6] | [![Codacy Badge][7]][8] | [![CodeFactor][9]][10] | [![GitHub license][11]][12] |
@@ -13,17 +16,20 @@
1316
Transform any object-graph into a dynamic, composed dictionaries like structure, holding serializable values and type information.
1417

1518
Aqua-core provides a bunch of serializable classes:
16-
* `DynamicObject`
17-
* `TypeInfo`
18-
* `FieldInfo`
19-
* `PropertyInfo`
20-
* `MethodInfo`
21-
* `ConstructorInfo`
19+
20+
- `DynamicObject`
21+
- `TypeInfo`
22+
- `FieldInfo`
23+
- `PropertyInfo`
24+
- `MethodInfo`
25+
- `ConstructorInfo`
2226

2327
Any object graph may be translated into a `DynamicObject` structure and back to it's original type using `DynamicObjectMapper`.
2428

2529
## Sample
30+
2631
Mapping an object graph into a `DynamicObject` and then back to it's original type
32+
2733
```C#
2834
Blog blog = new Blog
2935
{
@@ -92,3 +98,6 @@ Blog restoredBlog = new DynamicObjectMapper().Map(dynamicObject) as Blog;
9298
[26]: https://www.nuget.org/packages/aqua-core-text-json
9399
[27]: https://img.shields.io/myget/aqua/vpre/aqua-core-text-json.svg?style=flat-square&label=myget
94100
[28]: https://www.myget.org/feed/aqua/package/nuget/aqua-core-text-json
101+
102+
[pub-badge]: https://github.com/6bee/aqua-core/actions/workflows/publish.yml/badge.svg
103+
[pub-link]: https://github.com/6bee/aqua-core/actions/workflows/publish.yml

0 commit comments

Comments
 (0)