.NET 7 #127
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: | |
test: | |
name: Test | |
strategy: | |
matrix: | |
framwork: [net5.0, net6.0, net7.0] # net5.0 to test netstandard | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
dotnet-quality: ga | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Secret Injector | |
run: Get-ChildItem "./libNOM.test/Properties/" -File | ForEach-Object { (Get-Content $_.FullName) -Replace "{{ secrets.TESTSUITE_PASSWORD }}","${{ secrets.TESTSUITE_PASSWORD }}" | Set-Content $_.FullName } | |
shell: pwsh | |
- name: Unit Test | |
run: dotnet test libNOM.test --configuration Debug --framework ${{ matrix.framwork }} | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
dotnet-quality: ga | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Secret Injector | |
run: Get-ChildItem "./libNOM.io/Properties/" -File | ForEach-Object { (Get-Content $_.FullName) -Replace "{{ secrets.STEAM_API_KEY }}","${{ secrets.STEAM_API_KEY }}" | Set-Content $_.FullName } | |
shell: pwsh | |
- name: Pack | |
run: dotnet pack libNOM.io --configuration Release | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: NuGet | |
path: | | |
./.github/changelogs/ | |
./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: [test, build] | |
steps: | |
- name: Download | |
uses: actions/download-artifact@v3 | |
with: | |
name: 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/changelogs/${{ github.ref_name }}.md | |
files: ./libNOM.io.*nupkg | |
- name: Publish | |
run: dotnet nuget push ./libNOM.io/bin/Release/libNOM.io.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} |