Skip to content

Commit

Permalink
add github workflow for nuget publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
6bee authored Dec 13, 2023
1 parent 20d672b commit 3339709
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 7 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish

on:
push:
tags:
- v*

jobs:
build:
runs-on: windows-latest

steps:
- name: Extract version from tag
uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'

- name: Invalid version tag
if: steps.version.outputs.is_valid != 'true'
run: |
echo "Version tag format invalid: ${{ steps.version.outputs.full }}"
exit 1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Mandatory to use exact version from tag action

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Check version
# assert version match with project version so only pre-release label can be changed based on release tag
run: dotnet build -t:CheckVersion -c Release -p BuildVersion="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"

- name: Set version info
run: |
$VersionPrefix="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
$VersionSuffix="${{ steps.version.outputs.prerelease }}"
$IsStable="${{ steps.version.outputs.is_stable }}"
if ( -not $VersionSuffix ) {
$Version=$VersionPrefix
} else {
$Version="$VersionPrefix-$VersionSuffix"
}
echo "VersionPrefix=$VersionPrefix" >> $Env:GITHUB_ENV
echo "VersionSuffix=$VersionSuffix" >> $Env:GITHUB_ENV
echo "Version=$Version" >> $Env:GITHUB_ENV
echo "IsStable=$IsStable" >> $Env:GITHUB_ENV
echo "Create release: v$Version"
- name: Build
run: dotnet test Aqua.sln -c Release /bl

- name: Upload build log
uses: actions/upload-artifact@v3
with:
name: msbuild_log
path: msbuild.binlog
if-no-files-found: error

- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: nuget_packages
path: artifacts
if-no-files-found: error

- name: Publish packages
env:
MYGET_AUTH_TOKEN: ${{ secrets.MYGET_AUTH_TOKEN }}
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}
run: |
dotnet nuget push artifacts\*.nupkg -k "$env:MYGET_AUTH_TOKEN" -s https://www.myget.org/F/aqua/api/v3/index.json
dotnet nuget push artifacts\*.nupkg -k "$env:NUGET_AUTH_TOKEN" -s https://api.nuget.org/v3/index.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ nuget.exe
*.db
.vs/
config.test.json
*.binlog
*.log
/.build/
.testPublish/
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<MajorVersion>5</MajorVersion>
<MinorVersion>4</MinorVersion>
<PatchVersion>0</PatchVersion>
<PreReleaseLabel>alpha-001</PreReleaseLabel>
<PreReleaseLabel>dev</PreReleaseLabel>
</PropertyGroup>

<PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
</Exec>
</Target>
<Target Name="CheckVersion">
<Message Text="Check Version: '$(BuildVersion)' == '$(VersionPrefix)' [$(MSBuildProjectFile)]" Importance="high" />
<Error Condition=" '$(BuildVersion)' == '' " Text="Build version must not be emty" />
<Error Condition=" '$(BuildVersion)' != '$(VersionPrefix)' " Text="Build version '$(BuildVersion)' does not match project version '$(VersionPrefix)'" />
</Target>
</Project>
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# aqua-core

[![Github Workflow][pub-badge]][pub-link]

| branch | AppVeyor | Travis CI | Codecov.io | Codacy | CodeFactor | License |
| --- | --- | --- | --- | --- | --- | --- |
| `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] |
Expand All @@ -13,17 +16,20 @@
Transform any object-graph into a dynamic, composed dictionaries like structure, holding serializable values and type information.

Aqua-core provides a bunch of serializable classes:
* `DynamicObject`
* `TypeInfo`
* `FieldInfo`
* `PropertyInfo`
* `MethodInfo`
* `ConstructorInfo`

- `DynamicObject`
- `TypeInfo`
- `FieldInfo`
- `PropertyInfo`
- `MethodInfo`
- `ConstructorInfo`

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

## Sample

Mapping an object graph into a `DynamicObject` and then back to it's original type

```C#
Blog blog = new Blog
{
Expand Down Expand Up @@ -92,3 +98,6 @@ Blog restoredBlog = new DynamicObjectMapper().Map(dynamicObject) as Blog;
[26]: https://www.nuget.org/packages/aqua-core-text-json
[27]: https://img.shields.io/myget/aqua/vpre/aqua-core-text-json.svg?style=flat-square&label=myget
[28]: https://www.myget.org/feed/aqua/package/nuget/aqua-core-text-json

[pub-badge]: https://github.com/6bee/aqua-core/actions/workflows/publish.yml/badge.svg
[pub-link]: https://github.com/6bee/aqua-core/actions/workflows/publish.yml

0 comments on commit 3339709

Please sign in to comment.