-
-
Notifications
You must be signed in to change notification settings - Fork 49
95 lines (78 loc) · 2.78 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Smidge Build
on:
workflow_dispatch:
push:
branches:
- master
- develop
- 'release/*'
tags:
- 'v*'
pull_request:
branches:
- master
- develop
- 'release/*'
jobs:
build:
runs-on: ubuntu-latest
env:
Solution_File: Smidge.sln
Test_Proj: test/Smidge.Tests/Smidge.Tests.csproj
Configuration: Release
steps:
- name: Checkout
uses: actions/checkout@v3
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
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
5.0.x
6.0.x
7.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"
- uses: actions/upload-artifact@v2 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: smidge-test-results
path: ${{ github.workspace }}/_TestResults/tests.trx
# This will do a rebuild
- name: Pack
if: success()
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
- uses: actions/upload-artifact@v4 # upload nuget
if: ${{ success() }}
with:
name: smidge-nuget-${{ env.GitVersion_SemVer }}
path: ${{ github.workspace }}/_NugetOutput/*.*
- name: Publish to GitHub Packages
if: ${{ success() && github.event_name == 'pull_request' }}
run: dotnet nuget push "${{ github.workspace }}/_NugetOutput/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/shazwazza/index.json"