update gh-action #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish NuGet Package | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: # This allows the workflow to be triggered manually | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Extract version number | |
id: extract_version | |
run: | | |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
VERSION=${GITHUB_REF/refs\/tags\/v/} | |
else | |
VERSION="0.0.0" | |
fi | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Update version in .csproj | |
run: | | |
VERSION=${{ steps.extract_version.outputs.VERSION }} | |
sed -i "s|<Version>.*</Version>|<Version>${VERSION}</Version>|" WhoIsChecker.csproj | |
shell: bash | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build the project | |
run: dotnet build --configuration Release | |
- name: Pack the project | |
run: dotnet pack --configuration Release | |
# - name: Publish to NuGet | |
# env: | |
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
# run: dotnet nuget push bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json |