You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/09/06 07:52:08 UTC
[logging-parent] 07/30: Accept `distribution` profile properties in reusable workflow
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch release/10.0.0
in repository https://gitbox.apache.org/repos/asf/logging-parent.git
commit 504074337d608de8f1d0c33148b7f18585e3ac6a
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Mon Sep 4 11:49:22 2023 +0200
Accept `distribution` profile properties in reusable workflow
---
.github/workflows/build.yml | 1 +
.github/workflows/deploy-release-reusable.yml | 13 ++++++++++++-
pom.xml | 13 +++++++++----
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 73e2d6b..27f65e8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -57,3 +57,4 @@ jobs:
secrets: inherit
with:
project-name: logging-parent
+ distribution-attachment-count: 0
diff --git a/.github/workflows/deploy-release-reusable.yml b/.github/workflows/deploy-release-reusable.yml
index 6208f41..4f4ea81 100644
--- a/.github/workflows/deploy-release-reusable.yml
+++ b/.github/workflows/deploy-release-reusable.yml
@@ -28,6 +28,15 @@ on:
description: Identifier used in the distribution artifact and Subversion repository folder filenames (e.g., `logging-parent`)
required: true
type: string
+ # `distribution-*` input defaults should match the ones in `pom.xml`!
+ distribution-attachment-filepath-pattern:
+ description: The regex pattern matched against the full filepath for determining attachments to be included in the distribution
+ default: ^.*/target/log4j-(.+)-${project.version}(-tests)?\\.jar$
+ type: string
+ distribution-attachment-count:
+ description: The number of attachments expected to be found
+ required: true
+ type: number
secrets:
GPG_SECRET_KEY:
description: GPG secret key for signing artifacts
@@ -93,7 +102,9 @@ jobs:
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
- --non-recursive -P distribution
+ --non-recursive -P distribution \
+ -DattachmentFilepathPattern="${{ inputs.distribution-attachment-filepath-pattern }}" \
+ -DattachmentCount=${{ inputs.distribution-attachment-count }}
export DIST_FILENAME_PREFIX="apache-${{ inputs.project-name }}"
export DIST_FILENAME_VERSIONED_PREFIX="${DIST_FILENAME_PREFIX}-${PROJECT_VERSION}"
export DIST_FILEPATH="/tmp/${DIST_FILENAME_VERSIONED_PREFIX}.zip"
diff --git a/pom.xml b/pom.xml
index 5c8b008..f9bbbca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -542,9 +542,14 @@
<id>distribution</id>
+ <!-- These properties and their defaults should match the ones in `.github/workflows/deploy-release-reusable.yml`! -->
<properties>
+ <!-- The regex pattern matched against the full filepath for determining attachments to be included in the distribution: -->
<attachmentFilepathPattern>^.*/target/log4j-(.+)-${project.version}(-tests)?\\.jar$</attachmentFilepathPattern>
- <minAttachmentCount>1</minAttachmentCount>
+ <!-- The number of attachments expected to be found.
+ Setting the default to an excessive value to enforce the user to provide it explicitly.
+ That is, found attachments should precisely reflect what user expects. -->
+ <attachmentCount>999</attachmentCount>
</properties>
<build>
@@ -655,7 +660,7 @@
}
// Check if no attachments were found
- if (${minAttachmentCount} >= attachmentPathByFile.size()) {
+ if (${attachmentCount} != attachmentPathByFile.size()) {
System.err.println("Attachments:");
int[] i = {0};
attachmentPathByFile.values().forEach(new Consumer() {
@@ -664,8 +669,8 @@
}
});
System.err.format(
- "Error: Was expecting at least %d attachments, found %d!%n",
- new Object[]{${minAttachmentCount}, attachmentPathByFile.size()});
+ "Error: Was expecting %d attachments, found %d!%n",
+ new Object[]{${attachmentCount}, attachmentPathByFile.size()});
System.err.println("Tip: Have you already executed the Maven `package` goal?");
System.exit(1);
}