Skip to content

Changed to non deprecated property name #31

Changed to non deprecated property name

Changed to non deprecated property name #31

name: publish
on:
push:
branches: ["main"]
tags: ["v*.*.*"] # Publish semver tags as releases.
pull_request:
branches: ["main"]
env:
SOLUTION_DIR: src/Hooki
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_DIR }}
- name: Build
run: dotnet build ${{ env.SOLUTION_DIR }} --configuration Release --no-restore
- name: Test
run: dotnet test ${{ env.SOLUTION_DIR }} --no-restore
pack-and-publish:
needs: build-and-test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_DIR }}
- name: Build
run: dotnet build ${{ env.SOLUTION_DIR }} --configuration Release --no-restore
- name: Set version and trim leading 'v'
run: |
version=$(echo ${{ github.ref_name }} | sed 's/^v//')
echo "VERSION=$version" >> $GITHUB_ENV
echo "Set VERSION to $version"
- name: Pack
run: dotnet pack ${{ env.SOLUTION_DIR }} --configuration Release --no-build -p:PackageVersion=${{env.VERSION}} --output ./nupkgs
- name: Publish to NuGet
run: dotnet nuget push "./nupkgs/Hooki.*" --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate