Create release.yml (#48)

* Add CI/CD workflows for release and testing

- Introduced `release.yml` for building, testing, and publishing `GeoUK` and `GeoUK.OSTN` projects to NuGet.org on release events.
- Updated `pr.yml` to include .NET setup, dependency restoration, building, and testing steps.
- Modified `GeoUK.OSTN.sln` to include the new `GeoUK.OSTN.XUnit` project and ensure proper workflow file references.

* Update release.yml to pack NuGet packages for projects

Replaced dotnet build commands with dotnet pack for the
GeoUK and GeoUK.OSTN projects in the release workflow.
This change prepares the projects for distribution by
creating NuGet packages instead of just building them.
This commit is contained in:
Ieuan Walker
2025-07-11 13:01:31 +01:00
committed by GitHub
parent 53a391e3e3
commit 725df9ad9e
3 changed files with 60 additions and 1 deletions

View File

@@ -11,13 +11,17 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal

54
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack GeoUK
run: dotnet pack GeoUK/GeoUK.csproj -c Release /p:Version=${{ github.event.release.tag_name }} --no-restore
- name: Pack GeoUK.OSTN
run: dotnet pack GeoUK.OSTN/GeoUK.OSTN.csproj -c Release /p:Version=${{ github.event.release.tag_name }} --no-restore
- name: Upload GeoUK NuGet package
uses: actions/upload-artifact@v4
with:
name: GeoUK-nuget
path: GeoUK/bin/Release/GeoUK.${{ github.event.release.tag_name }}.nupkg
- name: Upload GeoUK.OSTN NuGet package
uses: actions/upload-artifact@v4
with:
name: GeoUK.OSTN-nuget
path: GeoUK.OSTN/bin/Release/GeoUK.OSTN.${{ github.event.release.tag_name }}.nupkg
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.1.1
- name: Publish GeoUK to NuGet.org
run: dotnet nuget push GeoUK/bin/Release/GeoUK.${{ github.event.release.tag_name }}.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{ secrets.NUGET_API_KEY }}
- name: Publish GeoUK.OSTN to NuGet.org
run: dotnet nuget push GeoUK.OSTN/bin/Release/GeoUK.OSTN.${{ github.event.release.tag_name }}.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{ secrets.NUGET_API_KEY }}