Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: 🏭 Build
name: 🏭 Build nuget

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

env:
DOTNET_VERSION: "10.x"

permissions:
contents: write
pull-requests: read

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -21,18 +29,22 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: true
cache-dependency-path: "**/packages.lock.json"

- uses: dotnet/nbgv@v0.5.1
id: nbgv
with:
setAllVars: true

- name: Restore dependencies
run: dotnet restore --locked-mode

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.5.0

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v4.5.0
with:
updateProjectFiles: true

- name: Build
run: dotnet build --no-restore -c Release

Expand All @@ -42,6 +54,6 @@ jobs:
- name: Upload Nuget package as Artifact
uses: actions/upload-artifact@v6
with:
name: ClosureOSS.WebPush.${{ steps.nbgv.outputs.NuGetPackageVersion }}
name: ClosureOSS.WebPush.${{ steps.gitversion.outputs.FullSemVer }}
path: ./artifacts/package/release/*nupkg
retention-days: 1
129 changes: 0 additions & 129 deletions .github/workflows/publish-release.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 🎁 Publish nuget package

on:
push:
tags:
- "v[0-9]*.[0-9]*.[0-9]*" # Pattern for standard: v1.2.3
- "v[0-9]*.[0-9]*.[0-9]*-*" # Pattern for pre-release: v1.2.3-alpha.1

env:
DOTNET_VERSION: "10.x"

permissions:
contents: write
pull-requests: read

jobs:
publish:
runs-on: ubuntu-latest
environment: public-release

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: true
cache-dependency-path: '**/packages.lock.json'

- name: Restore dependencies
run: dotnet restore --locked-mode

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.5.0

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v4.5.0
with:
updateProjectFiles: true

- name: Build
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build -c Release --verbosity normal

- name: Publish the package to NUGET
run: dotnet nuget push ./artifacts/package/release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_AUTH_TOKEN --skip-duplicate
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: "${{ github.ref_name }}"
generate_release_notes: true
files: ./artifacts/package/release/*nupkg
prerelease: ${{ steps.gitversion.outputs.PreReleaseTag != '' }}
11 changes: 5 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.9.50</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="6.7.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions WebPush.Test/WebPush.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest.TestAdapter" Version="4.2.1" />
<PackageReference Include="MSTest.TestFramework" Version="4.2.1" />
<PackageReference Include="MSTest.TestAdapter" Version="4.2.2" />
<PackageReference Include="MSTest.TestFramework" Version="4.2.2" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading