.NET 7 #76
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: libNOM.io | |
on: | |
pull_request: | |
branches: [ master ] | |
push: | |
branches: [ master ] | |
create: | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Replace (io) | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "#{STEAM_API_KEY}#" | |
replace: ${{ secrets.STEAM_API_KEY }} | |
include: "libNOM.io/Properties/**" | |
regex: false | |
- name: Replace (test) | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "#{TESTSUITE_PASSWORD}#" | |
replace: ${{ secrets.TESTSUITE_PASSWORD }} | |
include: "libNOM.test/Properties/**" | |
regex: false | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
dotnet-quality: ga | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Dependencies | |
run: dotnet restore | |
- name: Unit Test | |
run: | | |
dotnet test libNOM.test --no-restore --configuration Debug --framework netstandard2.0 | |
dotnet test libNOM.test --no-restore --configuration Debug --framework netstandard2.1 | |
dotnet test libNOM.test --no-restore --configuration Debug --framework net6.0 | |
dotnet test libNOM.test --no-restore --configuration Debug --framework net7.0 | |
- name: Pack | |
run: dotnet pack libNOM.io --no-restore --configuration Release | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libNOM.io NuGet | |
path: libNOM.io/bin/Release/libNOM.io.*nupkg | |
if-no-files-found: error | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
# Only if commit was tagged. | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
needs: build | |
steps: | |
# Checkout again to access the changelog. | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download | |
uses: actions/download-artifact@v3 | |
with: | |
name: libNOM.io NuGet | |
- name: Version | |
run: echo "nupkg_version=$((((Get-Item -Path .\libNOM.io.*.nupkg).Name -split '\.',3)[2] -split '\.',-2)[0])" >> $env:GITHUB_ENV | |
shell: pwsh | |
# Exit if version mismatch. | |
- name: Mismatch | |
if: ${{ github.ref_name != env.nupkg_version }} | |
run: | | |
echo "There is a version mismatch between git tag (${{ github.ref_name }}) and nupkg version (${{ env.nupkg_version }})!" | |
exit 1 | |
- name: Create | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: ${{ github.workspace }}/.github/changelogs/${{ github.ref_name }}.md | |
files: libNOM.io.*nupkg | |
- name: Publish | |
run: dotnet nuget push ./libNOM.io.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} |