Skip to content

Release 1.9.0: implement the remaining test placeholders and fix what they hid #30

Release 1.9.0: implement the remaining test placeholders and fix what they hid

Release 1.9.0: implement the remaining test placeholders and fix what they hid #30

name: build and publish
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
build:
name: build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Test
run: dotnet test EppLib.UnitTests/EppLib.UnitTests.csproj -c Release
- name: Check tag matches package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
version=$(dotnet msbuild EppLib/EppLib.csproj -getProperty:Version)
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "Tag $GITHUB_REF_NAME does not match package version $version"
exit 1
fi
- name: Pack
run: dotnet pack EppLib/EppLib.csproj -c Release -o artifacts
- uses: actions/upload-artifact@v7
with:
name: nupkg
path: artifacts/*.nupkg
publish:
name: publish to NuGet
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: nupkg
path: artifacts
- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
# Trusted publishing: exchanges the GitHub OIDC token for a short-lived NuGet API key.
- name: NuGet login
id: login
uses: NuGet/login@v1
with:
user: ademar
- name: Push
run: dotnet nuget push "artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json