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 abdce288434b5057c8ada297423665b425f5b4d3 Author: Volkan Yazıcı <[email protected]> AuthorDate: Wed Sep 6 09:50:58 2023 +0200 Split distribution into source and binary components --- .github/workflows/deploy-release-reusable.yml | 17 +++++++++++------ pom.xml | 22 +++++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy-release-reusable.yml b/.github/workflows/deploy-release-reusable.yml index 0664aed..de6d749 100644 --- a/.github/workflows/deploy-release-reusable.yml +++ b/.github/workflows/deploy-release-reusable.yml @@ -108,14 +108,19 @@ jobs: -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" - mv "target/dist.zip" "$DIST_FILEPATH" - gpg --armor --detach-sign --yes --pinentry-mode error "$DIST_FILEPATH" - sha512sum "$DIST_FILEPATH" > "$DIST_FILEPATH.sha512" + export DIST_FILEPATH_PREFIX="/tmp/${DIST_FILENAME_VERSIONED_PREFIX}" + export DIST_FILEPATH_SRC="${DIST_FILEPATH_PREFIX}-src.zip" + export DIST_FILEPATH_BIN="${DIST_FILEPATH_PREFIX}-bin.zip" + mv "target/src.zip" "$DIST_FILEPATH_SRC" + mv "target/bin.zip" "$DIST_FILEPATH_BIN" + for DIST_FILEPATH in "$DIST_FILEPATH_SRC" "$DIST_FILEPATH_BIN"; do + gpg --armor --detach-sign --yes --pinentry-mode error "$DIST_FILEPATH" + sha512sum "$DIST_FILEPATH" > "$DIST_FILEPATH.sha512" + done cat >> $GITHUB_ENV << EOF DIST_FILENAME_PREFIX=$DIST_FILENAME_PREFIX DIST_FILENAME_VERSIONED_PREFIX=$DIST_FILENAME_VERSIONED_PREFIX - DIST_FILEPATH=$DIST_FILEPATH + DIST_FILEPATH_PREFIX=$DIST_FILEPATH_PREFIX EOF - name: Upload to Subversion @@ -147,7 +152,7 @@ jobs: done # Copy the distribution - cp "$DIST_FILEPATH"* . + cp "$DIST_FILEPATH_PREFIX"* . # Add & commit changes svn add "$DIST_FILENAME_PREFIX"* diff --git a/pom.xml b/pom.xml index e6db75b..0d67fe4 100644 --- a/pom.xml +++ b/pom.xml @@ -646,19 +646,23 @@ pathByFile.put(repoCacheEntryPath, new File(repoDirectoryParent, repoCacheEntryPath).toPath()); } - // Create `src.zip` using Git-tracked files + // Create the source distribution using Git-tracked files zip("target/src.zip", pathByFile); - System.out.format("Generated source ZIP containing %d files.%n", new Object[]{pathByFile.size()}); + System.out.format("Generated the source distribution (`src.zip`) containing %d files.%n", new Object[]{pathByFile.size()}); - // Find auxiliary files that will go into the distribution + // Short-circuit if there is no binary distribution expected + if (${attachmentCount} == 0) { + return; + } + + // Find auxiliary files that will go into the binary distribution SortedMap pathByFile = new TreeMap(); - pathByFile.put("src.zip", new File("target/src.zip").toPath()); pathByFile.put("RELEASE-NOTES.md", new File("target/release-notes/${project.version}.md").toPath()); pathByFile.put("README.adoc", new File("README.adoc").toPath()); pathByFile.put("NOTICE.txt", new File("NOTICE.txt").toPath()); pathByFile.put("LICENSE.txt", new File("LICENSE.txt").toPath()); - // Find attachments that will go into the distribution + // Find attachments that will go into the binary distribution String attachmentFilepathPattern = "${attachmentFilepathPattern}"; System.out.format("Locating attachments matching the provided pattern: `%s`%n", new Object[] {attachmentFilepathPattern}); SortedMap attachmentPathByFile = new TreeMap(); @@ -668,7 +672,7 @@ public void accept(Path path) { if (Files.isRegularFile(path, /* required for BSH method resolution: */ new LinkOption[0]) && path.toAbsolutePath().toString().matches(attachmentFilepathPattern)) { - attachmentPathByFile.put(path.toFileName().toString(), path); + attachmentPathByFile.put(path.getFileName().toString(), path); } } }); @@ -696,10 +700,10 @@ System.exit(1); } - // Create the distribution ZIP + // Create the binary distribution pathByFile.putAll(attachmentPathByFile); - zip("target/dist.zip", pathByFile); - System.out.format("Generated distribution ZIP containing following %d files:%n", new Object[] {pathByFile.size()}); + zip("target/bin.zip", pathByFile); + System.out.format("Generated the binary distribution (`bin.zip`) containing following %d files:%n", new Object[] {pathByFile.size()}); for (String file : pathByFile.keySet()) { System.out.println("-> " + file); }]]></script>
