Skip to content

v7.2.1

v7.2.1 #25

Workflow file for this run

name: .NET Publish
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to pack for a dry run (build/test/pack/upload only — no nuget push)"
required: false
default: "0.0.0-dryrun"
concurrency:
group: publish-${{ github.event.release.tag_name || github.run_id }}
cancel-in-progress: false
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-dotnet
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --no-build
publish:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-dotnet
- name: Resolve package version
env:
EVENT: ${{ github.event_name }}
TAG: ${{ github.event.release.tag_name }}
INPUT_VERSION: ${{ inputs.version }}
run: |
if [ "$EVENT" = "release" ]; then version="${TAG#v}"; else version="$INPUT_VERSION"; fi
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] \
|| { echo "::error::invalid version '$version' (event '$EVENT')"; exit 1; }
echo "Publishing version $version"
echo "PACKAGE_VERSION=$version" >> "$GITHUB_ENV"
- name: Restore
run: dotnet restore
- name: Pack
run: dotnet pack Pool.slnx -c Release --no-restore -o nuget -p:PackageVersion=$PACKAGE_VERSION -p:Version=$PACKAGE_VERSION
- name: Upload package artifacts
uses: actions/upload-artifact@v7
with:
name: nuget-packages
path: nuget/*
retention-days: 30
- name: Publish to api.nuget.org
if: github.event_name == 'release'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push nuget/*.nupkg --skip-duplicate -k "$NUGET_API_KEY" -s https://api.nuget.org/v3/index.json