Skip to content

Commit

Permalink
Add Github Actions Workflow for nuget packaging & releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninds committed Jun 28, 2020
1 parent e972c73 commit 279c4a9
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 7 deletions.
34 changes: 33 additions & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Test

on:
push:
branches: [ master ]
branches: [ master, release, prerelease]
pull_request:
branches: [ master ]

Expand Down Expand Up @@ -43,3 +43,35 @@ jobs:
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test Ryu.Net.UnitTests/bin/Release/netcoreapp3.1/Ryu.NET.UnitTests.dll
package:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/release' || github.ref == 'refs/heads/prerelease'
steps:
- uses: actions/checkout@v2
- name: Build_Package
run : |
dotnet pack Ryu.Net\\Ryu.NET.csproj -c Release --output=package_output
id : Build_Package
- name: Tag commit
uses: tvdias/github-tagger@v0.0.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ steps.Build_Package.outputs.version }}"
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "package_output/*.nupkg"
prerelease: ${{ github.ref == 'refs/heads/prerelease'}}
draft: false
tag: "${{ steps.Build_Package.outputs.version }}"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Github Package
uses: tanaka-takayoshi/nuget-publish-to-github-packages-action@v2.1
with:
nupkg-path: "package_output/*.nupkg"
repo-owner: 'Narinder Claire'
gh-user: 'Ninds'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push with dotnet
run: dotnet nuget push package_output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
5 changes: 5 additions & 0 deletions Ryu.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateD2STestData", "util
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateD2SSmallerTestData", "utils\GenerateD2SSmallerTestData\GenerateD2SSmallerTestData.csproj", "{7AC3930A-3079-4CEE-B177-1D56F0AFCF0A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5F02CCEA-D3F0-4325-B0EB-7078275235C9}"
ProjectSection(SolutionItems) = preProject
.github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
32 changes: 26 additions & 6 deletions Ryu.Net/Ryu.NET.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project InitialTargets="SetVersion" Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<Version>0.0.0-dev$([System.DateTime]::Now.ToString(yyMMddhhmm))</Version>
<Title>Ryu.NET</Title>
<Description>
<![CDATA[ Ryu.NET is a .NET port of Ryu (https://github.com/ulfjack/ryu) implementing Ryū (https://dl.acm.org/doi/10.1145/3192366.3192369), the fast algorithm for converting between strings and floats. ]]>
</Description>
<RepositoryUrl>https://github.com/Ninds/Ryu.NET</RepositoryUrl>
<RepositoryCommit>$(GITHUB_SHA)</RepositoryCommit>
<RepositoryBranch>$(GITHUB_REF)</RepositoryBranch>
<PackageLicenseExpression>BSL-1.0 OR Apache-2.0</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Internal\f2s.cs" />
<Compile Remove="Internal\f2s_full_table.cs" />
<Compile Remove="Internal\floating_decimal_32.cs" />
<ItemGroup>
<Compile Remove="Internal\f2s.cs" />
<Compile Remove="Internal\f2s_full_table.cs" />
<Compile Remove="Internal\floating_decimal_32.cs" />
</ItemGroup>


Expand All @@ -29,6 +37,18 @@
<AdditionalFiles Include="PublicAPI.Unshipped.txt" />
</ItemGroup>

<PropertyGroup Condition=" '$(GITHUB_REF)' == 'refs/heads/release' and '$(CI)' == 'true' ">
<Version>$([System.DateTime]::Now.ToString(yy.MM.dd))</Version>
</PropertyGroup>

<PropertyGroup Condition=" '$(GITHUB_REF)' == 'refs/heads/prerelease' and '$(CI)' == 'true' ">
<Version>$([System.DateTime]::Now.ToString(yy.MM.dd))-dev</Version>
</PropertyGroup>


<Target Name="SetVersion">
<Message Text="::set-output name=version::$(Version)" Importance="high" />
</Target>


</Project>

0 comments on commit 279c4a9

Please sign in to comment.