Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework ci pipeline, improve nuget build metadata #83

Merged
merged 23 commits into from
Jan 19, 2024
Merged
58 changes: 44 additions & 14 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
name: .NET Core
on: push
on:
push:
workflow_dispatch:
release:
types: [published]

env:
DEFAULT_VERSION: "3.1.0.4-alpha"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.108
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test
run: dotnet test src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj
- name: Publish
run: |
dotnet pack . -p:PackageVersion=3.1.0.6 -o .
dotnet nuget push src/PostalCodes/PostalCodes.3.1.0.6.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
- uses: actions/checkout@v4
- name: Setup .NET Core 2.2
uses: actions/setup-dotnet@v3
with:
dotnet-version: 2.2.x
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
- name: Setup .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build with dotnet
run: dotnet build --configuration Release /p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj
- name: Extract Version from Release Tag
id: get_version
run: echo "VERSION=$(echo '${{ github.event.release.tag_name || env.DEFAULT_VERSION }}' | sed -e 's/^v\.//')" >> $GITHUB_ENV
- name: Create nuget package
run: dotnet pack . -p:PackageVersion=${{ env.VERSION }} -o out --no-build
- name: Install dotnet-validate
run: dotnet tool install --global dotnet-validate --version 0.0.1-preview.304

- name: Validate NuGet package
run: dotnet-validate package local out/*.nupkg

- name: Publish
run: |
dotnet nuget push out/PostalCodes.${{ env.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
21 changes: 0 additions & 21 deletions PostalCodes.Net.nuspec

This file was deleted.

4 changes: 2 additions & 2 deletions src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>netcoreapp2.2;netcoreapp3.1;net6.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
Expand All @@ -11,4 +11,4 @@
<ItemGroup>
<ProjectReference Include="..\PostalCodes\PostalCodes.csproj" />
</ItemGroup>
</Project>
</Project>
19 changes: 17 additions & 2 deletions src/PostalCodes/PostalCodes.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net6.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Update="Generated\PostalCodeFactory.gen.tt">
Expand All @@ -11,11 +11,26 @@
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
<PropertyGroup>
<PackageId>PostalCodes</PackageId>
<Version></Version>
<Title>PostalCodes</Title>
<Authors>Rafał Nowosielski, Ivan Stanishev, Brendan Shea</Authors>
<Description>Library that provides zip code validation, formatting and simple arithmetic</Description>
<Copyright>Cimpress 2024</Copyright>
<PackageTags>PostalCode, ZipCode, PostalCodes, ZipCodes, postal-code, postal-codes, zip-code, zip-codes</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Cimpress-MCP/PostalCodes.Net</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<Compile Update="Generated\PostalCodeFactory.gen.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>PostalCodeFactory.gen.tt</DependentUpon>
</Compile>
</ItemGroup>
</Project>
</Project>