1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-22 03:54:33 -05:00

build: restore previous method for getting the GIT_HASH

This commit is contained in:
tangowithfoxtrot 2025-05-19 11:20:42 -07:00
parent 30369d9a8a
commit 9d4a96b078
No known key found for this signature in database
13 changed files with 17 additions and 22 deletions

View File

@ -52,4 +52,21 @@
<AutoFixtureAutoNSubstituteVersion>4.18.1</AutoFixtureAutoNSubstituteVersion>
</PropertyGroup>
<!--
This section is for getting & setting the gitHash value, which can easily be accessed
via the Core.Utilities.AssemblyHelpers class.
-->
<Target Name="SetSourceRevisionId" BeforeTargets="CoreGenerateAssemblyInfo">
<Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
</Exec>
</Target>
<Target Name="WriteRevision" AfterTargets="SetSourceRevisionId">
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>GitHash</_Parameter1>
<_Parameter2>$(SourceRevisionId)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>

View File

@ -31,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -39,7 +38,6 @@ RUN npm run build
RUN . /tmp/rid.txt && dotnet publish \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -31,7 +30,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -30,7 +30,6 @@ WORKDIR /source/util/Server
RUN . /tmp/rid.txt && dotnet publish \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -46,7 +45,6 @@ WORKDIR /source/util/MsSqlMigratorUtility
RUN . /tmp/rid.txt && dotnet publish \
--self-contained \
/p:PublishSingleFile=true \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out

View File

@ -2,7 +2,6 @@
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG GIT_COMMIT
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
@ -32,7 +31,6 @@ RUN . /tmp/rid.txt && dotnet publish \
-c release \
--no-restore \
--self-contained \
/p:SourceRevisionId="$GIT_COMMIT" \
-r $RID \
-o out