Merge pull request #332 from nzdev/v3/package-update #302
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: Examine Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'dev' | |
- 'release/*' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
Solution_File: src/Examine.sln | |
Test_Proj: src/Examine.Test/Examine.Test.csproj | |
Configuration: Release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Create copyright value | |
run: | | |
$Copyright = "Copyright " + [char]0x00A9 + " Shannon Deminick " + (Get-Date).year | |
echo ("Copyright=" + $Copyright) >> $Env:GITHUB_ENV | |
shell: pwsh | |
- name: Setup .NET Core SDK 5.0.x | |
uses: actions/[email protected] | |
with: | |
dotnet-version: 5.0.x | |
- name: Setup .NET SDK 6.0.x | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Install dependencies | |
run: dotnet restore ${{ env.Solution_File }} | |
- name: Build | |
run: dotnet build ${{ env.Solution_File }} --configuration ${{ env.Configuration }} --no-restore | |
- name: Test | |
run: dotnet test "${{ env.Test_Proj }}" --no-build --verbosity normal --results-directory ${{ github.workspace }}/_TestResults --logger "trx;logfilename=tests.trx" | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 # upload test results | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: examine-test-results | |
path: ${{ github.workspace }}/_TestResults/tests.trx | |
- name: Pack | |
if: success() | |
# This will do a rebuild | |
run: | | |
dotnet pack ${{ env.Solution_File }} \ | |
--configuration ${{ env.Configuration }} \ | |
--no-restore \ | |
-p:PackageVersion=${{ env.GitVersion_SemVer }} \ | |
-p:AssemblyVersion=${{ env.GitVersion_AssemblySemVer }} \ | |
-p:FileVersion=${{ env.GitVersion_AssemblySemFileVer }} \ | |
-p:InformationalVersion=${{ env.GitVersion_InformationalVersion }} \ | |
-p:ContinuousIntegrationBuild=true \ | |
-p:Copyright="${{ env.Copyright }}" \ | |
--output=${{ github.workspace }}/_NugetOutput | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 # upload nuget | |
if: success() | |
with: | |
name: examine-nuget-${{ env.GitVersion_SemVer }} | |
path: ${{ github.workspace }}/_NugetOutput/*.* | |
- name: Publish to GitHub Packages | |
run: dotnet nuget push "${{ github.workspace }}/_NugetOutput/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/shazwazza/index.json" |