Update publish.yml #4
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: Build, Test, and Publish Nuget Package | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
env: | |
VERSION: 1.0.0 | |
defaults: | |
run: | |
working-directory: src | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set Version Variable | |
if: ${{ github.ref_type == 'tag' }} | |
env: | |
TAG: ${{ github.ref_name }} | |
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore /p:Version=$VERSION | |
- name: Test | |
run: dotnet test --configuration Release --no-build --verbosity normal | |
- name: Pack | |
run: dotnet pack --configuration Release --output nupkgs --no-restore --no-build /p:PackageVersion=$VERSION | |
- name: Push | |
run: | | |
dotnet nuget add source --username AleRoe --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/AleRoe/index.json" | |
dotnet nuget push nupkgs/*.nupkg --source https://nuget.pkg.github.com/AleRoe/index.json --api-key ${{ secrets.GITHUB_TOKEN }} | |