-
Notifications
You must be signed in to change notification settings - Fork 8
79 lines (68 loc) · 2.49 KB
/
build.yml
File metadata and controls
79 lines (68 loc) · 2.49 KB
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
name: Build and Publish
on:
push:
branches: [ main, master ] # Adjust if your default branch is different
pull_request:
branches: [ main, master ]
jobs:
build:
runs-on: ubuntu-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BUILD_CONFIGURATION: Release
steps:
- name: Calculate version (run_number + 550)
id: version
shell: pwsh
run: |
$number = [int]$env:GITHUB_RUN_NUMBER + 550
echo "BUILD_VERSION=1.0.$number" >> $env:GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Setup .NET 10 SDK
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: '10.0.x'
- name: Display .NET version
run: dotnet --version
- name: Cache NuGet packages
uses: actions/cache@v5.0.5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj', '**/*.props', '**/*.targets') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore ./Cogs.Console.sln --verbosity minimal
- name: Build solution
run: >
dotnet build ./Cogs.Console.sln
--configuration ${{ env.BUILD_CONFIGURATION }}
--verbosity minimal
--no-restore
-p:Version=${{ steps.version.outputs.BUILD_VERSION }}
-p:PackageVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:AssemblyVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:FileVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:InformationalVersion=${{ steps.version.outputs.BUILD_VERSION }}
- name: Pack NuGet packages
run: >
dotnet pack Cogs.Console/Cogs.Console.csproj
--configuration ${{ env.BUILD_CONFIGURATION }}
--no-build
-o ./nupkg
-p:Version=${{ steps.version.outputs.BUILD_VERSION }}
-p:PackageVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:AssemblyVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:FileVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:InformationalVersion=${{ steps.version.outputs.BUILD_VERSION }}
-p:IncludeSymbols=true
-p:SymbolPackageFormat=snupkg
- name: Upload NuGet package as artifact (now only ONE package)
uses: actions/upload-artifact@v7.0.1
with:
name: CogsNuGetPackage
path: ./nupkg/*.nupkg
if-no-files-found: error