修复后端构建提交号注入
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
<angus-mail.version>2.0.3</angus-mail.version>
|
||||
<aliyun-oss.version>3.18.3</aliyun-oss.version>
|
||||
<apache-poi.version>5.4.1</apache-poi.version>
|
||||
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
|
||||
<th.hotel.build.commit>UNKNOWN</th.hotel.build.commit>
|
||||
</properties>
|
||||
|
||||
@@ -125,6 +126,51 @@
|
||||
<parameters>${maven.compiler.parameters}</parameters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>${maven-antrun-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>verify-build-commit-before-package</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target name="verify-build-commit-before-package">
|
||||
<condition property="th.hotel.build.commit.unknown">
|
||||
<equals arg1="${th.hotel.build.commit}" arg2="UNKNOWN"/>
|
||||
</condition>
|
||||
<fail if="th.hotel.build.commit.unknown"
|
||||
message="TH_HOTEL_BUILD_COMMIT is required before packaging. Commit changes first, then use scripts/package-server-with-build-info.sh or set TH_HOTEL_BUILD_COMMIT to the current Git commit."/>
|
||||
<exec executable="git" failonerror="true">
|
||||
<arg value="rev-parse"/>
|
||||
<arg value="--verify"/>
|
||||
<arg value="--quiet"/>
|
||||
<arg value="${th.hotel.build.commit}^{commit}"/>
|
||||
</exec>
|
||||
<exec executable="git" failonerror="true">
|
||||
<arg value="update-index"/>
|
||||
<arg value="-q"/>
|
||||
<arg value="--refresh"/>
|
||||
</exec>
|
||||
<exec executable="git" failonerror="true" outputproperty="th.hotel.git.status">
|
||||
<arg value="status"/>
|
||||
<arg value="--porcelain"/>
|
||||
</exec>
|
||||
<condition property="th.hotel.git.dirty">
|
||||
<not>
|
||||
<equals arg1="${th.hotel.git.status}" arg2=""/>
|
||||
</not>
|
||||
</condition>
|
||||
<fail if="th.hotel.git.dirty"
|
||||
message="Git worktree must be clean before packaging a deployment-proof Jar. Commit or stash changes first. Dirty entries: ${th.hotel.git.status}"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user