Skip to content

Commit

Permalink
Add automatic assembly versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Jun 17, 2024
1 parent 8abbafd commit f7a08c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build

on:
push:
branches: [ master ]
branches: [ master, CI ]
pull_request:
branches: [ master ]
workflow_dispatch:
Expand Down Expand Up @@ -49,6 +49,12 @@ jobs:
7z.exe x "-p${env:KSP_ZIP_PASSWORD}" 'KSP_Assemblies.zip' "-o${KSP_DLL_PATH}"
rm 'KSP_Assemblies.zip'
- name: Update AssemblyInfo
uses: KSP-RO/BuildTools/update-assembly-info@master
with:
path: ${GITHUB_WORKSPACE}/src/RealAntennasProject/Properties/AssemblyInfo.cs
tag: ${{ github.event.release.tag_name }}

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2

Expand Down
12 changes: 9 additions & 3 deletions src/RealAntennasProject/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
#define CIBUILD_disabled
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down Expand Up @@ -33,4 +33,10 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
#if CIBUILD
[assembly: AssemblyFileVersion("@MAJOR@.@MINOR@.@PATCH@.@BUILD@")]
[assembly: KSPAssembly("RealAntennas", @MAJOR@, @MINOR@)]
#else
[assembly: AssemblyFileVersion("2.99.0.0")]
[assembly: KSPAssembly("RealAntennas", 2, 99)]
#endif

0 comments on commit f7a08c4

Please sign in to comment.