fix: ensure correct version on packaged assemblies #15
This file contains hidden or 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: CI Build | |
env: | |
# Stop wasting time caching packages | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending usage data to Microsoft | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: windows-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
- name: Set env | |
if: startsWith( github.ref, 'refs/tags/v' ) | |
run: | | |
chcp 65001 #set code page to utf-8 | |
$RELEASE_VERSION=$env:GITHUB_REF.Replace('refs/tags/', '') | |
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $env:GITHUB_ENV | |
echo ("Version=" + $RELEASE_VERSION.Substring(1)) >> $env:GITHUB_ENV | |
- name: Restore | |
run: dotnet tool restore | |
- name: Build | |
run: dotnet build -c Release | |
- name: Test | |
run: dotnet test --no-build -c Release tests | |
- name: Pack | |
run: dotnet pack --no-restore -c Release --include-symbols -o bin | |
- name: Upload Test Results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: verify-test-results | |
path: | | |
**/*.received.* | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nupkg-${{ matrix.runs-on }} | |
path: ./bin/*nupkg | |
- name: Push | |
if: startsWith( github.ref, 'refs/tags/v' ) | |
run: dotnet nuget push bin\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }} |