Skip to content

Commit 0220e1e

Browse files
Automatically create releases
1 parent f2e78d0 commit 0220e1e

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ jobs:
1111
strategy:
1212
matrix:
1313
dotnet: [ '3.1.x' ]
14-
name: Dotnet ${{ matrix.dotnet }}
14+
name: .NET Core ${{ matrix.dotnet }}
1515

1616
runs-on: ubuntu-latest
17+
outputs:
18+
version: ${{ steps.get_version.outputs.version }}
1719

1820
steps:
1921
- uses: actions/checkout@v2
22+
23+
# https://github.com/actions/setup-dotnet/
2024
- name: Setup .NET Core
2125
uses: actions/setup-dotnet@v1
2226
with:
@@ -30,6 +34,12 @@ jobs:
3034

3135
- name: Create the package
3236
run: dotnet pack --configuration Release System.Text.Json.Extensions
37+
- name: Get Version
38+
id: get_version
39+
shell: pwsh
40+
run: |
41+
Write-Host "::set-output name=packageAndVersion::$(Split-Path -Path $(Resolve-Path "System.Text.Json.Extensions/bin/Release/*.nupkg") -LeafBase)"
42+
Write-Host "::set-output name=version::$((Split-Path -Path $(Resolve-Path "System.Text.Json.Extensions/bin/Release/*.nupkg") -LeafBase) -replace '^.*?(\d.*)$','$1')"
3343
- uses: actions/upload-artifact@v2
3444
with:
3545
name: Dotnet ${{ matrix.dotnet }}
@@ -61,3 +71,25 @@ jobs:
6171
- name: Publish the package to GPR
6272
if: success() && github.event_name == 'push' && matrix.dotnet == '3.1.x'
6373
run: dotnet nuget push System.Text.Json.Extensions/bin/Release/*.nupkg
74+
75+
- name: Create Release
76+
id: create_release
77+
if: success() && github.event_name == 'push' && matrix.dotnet == '3.1.x'
78+
uses: actions/create-release@v1
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
tag_name: v${{ steps.get_version.version }}
83+
release_name: Release ${{ steps.get_version.version }}
84+
draft: true
85+
prerelease: false
86+
- name: Upload Release Asset
87+
if: success() && github.event_name == 'push' && matrix.dotnet == '3.1.x'
88+
uses: actions/upload-release-asset@v1
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
upload_url: ${{ steps.create_release.outputs.upload_url }}
93+
asset_path: System.Text.Json.Extensions/bin/Release/${{ steps.get_version.packageAndVersion }}.nupkg
94+
asset_name: ${{ steps.get_version.packageAndVersion }}.nupkg
95+
asset_content_type: application/zip

System.Text.Json.Extensions/System.Text.Json.Extensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.1</TargetFramework>
55
<PackageId>System.Text.Json.Extensions</PackageId>
6-
<Version>1.0.5</Version>
6+
<Version>1.0.6</Version>
77
<Authors>TheConstructor</Authors>
88
<PackageDescription>This package tries to collect some extensions and converters that ease the usage of System.Text.Json.</PackageDescription>
99
<RepositoryUrl>https://github.com/TheConstructor/System.Text.Json.Extensions</RepositoryUrl>

0 commit comments

Comments
 (0)