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
commit 311ae66856ab078b59e55d256b91faed5c802a96 Author: Volkan Yazıcı <[email protected]> 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 edf93e8..92664cf 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); }
