This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-parent.git
The following commit(s) were added to refs/heads/main by this push:
new 34cf9e4 Used `project.build.outputTimestamp` to timestamp generated
distribution files
34cf9e4 is described below
commit 34cf9e4d58bcbc89767a7264c7b3413c27257de0
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Mon Oct 2 10:10:12 2023 +0200
Used `project.build.outputTimestamp` to timestamp generated distribution
files
---
.github/workflows/deploy-release-reusable.yaml | 8 +++++++-
pom.xml | 3 ++-
src/changelog/.10.x.x/timestamp.xml | 8 ++++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/deploy-release-reusable.yaml
b/.github/workflows/deploy-release-reusable.yaml
index a9b16da..ed65e3a 100644
--- a/.github/workflows/deploy-release-reusable.yaml
+++ b/.github/workflows/deploy-release-reusable.yaml
@@ -135,13 +135,19 @@ jobs:
if: inputs.site-enabled
shell: bash
run: |
+ export TIMESTAMP=$(./mvnw \
+ --non-recursive --quiet --batch-mode \
+ -DforceStdout=true \
+ -Dexpression=project.build.outputTimestamp \
+ help:evaluate \
+ | tail -n 1)
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
--non-recursive \
site
cd target/site
find . -empty -type d -delete
- find . -print0 | xargs -0 touch -d 1970-01-01T00:00:00Z
+ find . -print0 | xargs -0 touch -d "$TIMESTAMP"
find . -print0 | sort --zero-terminated | xargs -0 zip -oX
../site.zip
- name: Upload to Nexus
diff --git a/pom.xml b/pom.xml
index bd8f9fc..d608e60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -842,6 +842,7 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
+ long timestampMillis =
java.time.Instant.parse("${project.build.outputTimestamp}").toEpochMilli();
zip(String zipFileName, Map pathByFile) {
OutputStream outputStream = new
FileOutputStream(zipFileName);
ZipOutputStream zipOutputStream = new
ZipOutputStream(outputStream);
@@ -849,7 +850,7 @@
for (String file : pathByFile.keySet()) {
Path path = pathByFile.get(file);
ZipEntry zipEntry = new ZipEntry(file);
- zipEntry.setTime(0);
+ zipEntry.setTime(timestampMillis);
zipOutputStream.putNextEntry(zipEntry);
zipOutputStream.write(Files.readAllBytes(path));
zipOutputStream.closeEntry();
diff --git a/src/changelog/.10.x.x/timestamp.xml
b/src/changelog/.10.x.x/timestamp.xml
new file mode 100644
index 0000000..2cc1f6f
--- /dev/null
+++ b/src/changelog/.10.x.x/timestamp.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://logging.apache.org/log4j/changelog"
+ xsi:schemaLocation="http://logging.apache.org/log4j/changelog
https://logging.apache.org/log4j/changelog-0.1.1.xsd"
+ type="added">
+ <author id="github:vy"/>
+ <description format="asciidoc">Used `project.build.outputTimestamp` to
timestamp generated distribution files</description>
+</entry>