Skip to content

Commit

Permalink
fix: or-1566 use csharp script for solution info
Browse files Browse the repository at this point in the history
  • Loading branch information
koenmetsu committed May 27, 2024
1 parent bcfc4e7 commit 822bc4d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
"commands": [
"dotnet-dotcover"
]
},
"dotnet-script": {
"version": "1.5.0",
"commands": [
"dotnet-script"
]
}
}
}
21 changes: 21 additions & 0 deletions .github/build-scripts/SetSolutionInfo.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.IO;

var buildNumber = Environment.GetEnvironmentVariable("CI_BUILD_NUMBER") ?? "0.0.0";
var gitHash = Environment.GetEnvironmentVariable("GIT_HASH") ?? "unknown";
var product = "Basisregisters Vlaanderen";
var copyright = "Copyright (c) Vlaamse overheid";
var company = "Vlaamse overheid";

var content = $@"
using System.Reflection;
[assembly: AssemblyVersion(""{buildNumber}"")]
[assembly: AssemblyFileVersion(""{buildNumber}"")]
[assembly: AssemblyInformationalVersion(""{gitHash}"")]
[assembly: AssemblyProduct(""{product}"")]
[assembly: AssemblyCopyright(""{copyright}"")]
[assembly: AssemblyCompany(""{company}"")]
";

File.WriteAllText("SolutionInfo.cs", content);
4 changes: 4 additions & 0 deletions .github/build-scripts/set-solution-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dotnet tool restore;
dotnet tool install dotnet-script;
dotnet tool update dotnet-script;
dotnet dotnet-script .github/build-scripts/SetSolutionInfo.csx
5 changes: 3 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,11 @@ jobs:
- name: Set solution info
shell: bash
if: inputs.semver != 'none'
run: CI_BUILD_NUMBER=$SEMVER ./build.sh SetSolutionInfo
run: |
docker run --network host -e CI_BUILD_NUMBER -e GIT_HASH --rm -v $(pwd):/app -w /app/ mcr.microsoft.com/dotnet/sdk:6.0.201 /bin/sh .github/build-scripts/set-solution-info.sh
env:
BUILD_DOCKER_REGISTRY: ${{ secrets.BUILD_DOCKER_REGISTRY_IK4 }}
SEMVER: ${{ inputs.semver }}
CI_BUILD_NUMBER: ${{ inputs.semver }}

- name: Pre-build Marten models
if: ${{ inputs.pre-gen-marten }}
Expand Down

0 comments on commit 822bc4d

Please sign in to comment.