diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index ad476f50e..bef97cf0c 100755 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -31,6 +31,12 @@ "commands": [ "dotnet-dotcover" ] + }, + "dotnet-script": { + "version": "1.5.0", + "commands": [ + "dotnet-script" + ] } } } \ No newline at end of file diff --git a/.github/build-scripts/SetSolutionInfo.csx b/.github/build-scripts/SetSolutionInfo.csx new file mode 100644 index 000000000..89ba2b7af --- /dev/null +++ b/.github/build-scripts/SetSolutionInfo.csx @@ -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); \ No newline at end of file diff --git a/.github/build-scripts/set-solution-info.sh b/.github/build-scripts/set-solution-info.sh new file mode 100755 index 000000000..137993b91 --- /dev/null +++ b/.github/build-scripts/set-solution-info.sh @@ -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 diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 77574c346..a28133ba8 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -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 }}