You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/10/17 07:27:15 UTC

(logging-parent) 01/01: Export deployment data to calling workflow

This is an automated email from the ASF dual-hosted git repository.

pkarwasz pushed a commit to branch feature/deployment-outputs
in repository https://gitbox.apache.org/repos/asf/logging-parent.git

commit 77d8114e9e55334642fe1cc4e36f3cb27aa0a7a7
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Thu Oct 17 09:26:55 2024 +0200

    Export deployment data to calling workflow
    
    This adds two outputs to both the `deploy-release-reusable` and `deploy-snapshot-reusable` workflows:
    
    - `project-version`: contains the version of the deployed project.
    - `project-repository-url`: contains the URL of the Nexus repository, where the artifacts were deployed.
    
    [It also fixes a small YAML syntax error, ignored by GitHub, but reported by IDEA]
---
 .github/workflows/deploy-release-reusable.yaml   |  6 +++++-
 .github/workflows/deploy-snapshot-reusable.yaml  |  5 +++++
 src/changelog/.11.x.x/export_deployment_data.xml | 10 ++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/deploy-release-reusable.yaml b/.github/workflows/deploy-release-reusable.yaml
index 5486194..4a4fabd 100644
--- a/.github/workflows/deploy-release-reusable.yaml
+++ b/.github/workflows/deploy-release-reusable.yaml
@@ -82,6 +82,8 @@ jobs:
           }
           export PROJECT_VERSION=$(echo "$GIT_BRANCH_NAME" | sed 's/^release\///')
           echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
+          # Export version to calling workflow
+          echo "project-version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
 
       - name: Set the Maven `revision` property
         shell: bash
@@ -145,6 +147,8 @@ jobs:
             -P deploy,release
           export NEXUS_URL=$(awk '/^(stagingRepository.url)/ { gsub(/(^.+=|\\)/, ""); print $1 }' target/nexus-staging/staging/*.properties)
           echo "NEXUS_URL=$NEXUS_URL" >> $GITHUB_ENV
+          # Export repository URL to calling workflow
+          echo "project-repository-url=$NEXUS_URL" >> $GITHUB_OUTPUT
 
       # Node.js cache is needed for Antora
       - name: Set up Node.js cache
@@ -158,7 +162,7 @@ jobs:
           # For that, we need to configure `dependabot` to update hundreds of dependencies listed in `package-lock.json`.
           # That translates to a never ending rain of `dependabot` PRs.
           # I doubt if the wasted CPU cycles worth the gain.
-          key: ${{ runner.os }}-nodejs-cache-${{ hashFiles('node', 'node_modules') }}
+          key: "${{ runner.os }}-nodejs-cache-${{ hashFiles('node', 'node_modules') }}"
           # `actions/cache` doesn't recommend caching `node_modules`.
           # Though none of its recipes fit our bill, since we install Node.js using `frontend-maven-plugin`.
           # See https://github.com/actions/cache/blob/main/examples.md#node---npm
diff --git a/.github/workflows/deploy-snapshot-reusable.yaml b/.github/workflows/deploy-snapshot-reusable.yaml
index 40a922c..b27d94c 100644
--- a/.github/workflows/deploy-snapshot-reusable.yaml
+++ b/.github/workflows/deploy-snapshot-reusable.yaml
@@ -59,6 +59,8 @@ jobs:
             help:evaluate \
             | tail -n 1)
           echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
+          # Export version to calling workflow
+          echo "project-version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
 
       - name: Upload to Nexus
         shell: bash
@@ -70,3 +72,6 @@ jobs:
           ./mvnw \
             --show-version --batch-mode --errors --no-transfer-progress \
             -P deploy
+          export NEXUS_URL=$(awk '/^(stagingRepository.url)/ { gsub(/(^.+=|\\)/, ""); print $1 }' target/nexus-staging/staging/*.properties)
+          # Export repository URL to calling workflow
+          echo "project-repository-url=$NEXUS_URL" >> $GITHUB_OUTPUT
\ No newline at end of file
diff --git a/src/changelog/.11.x.x/export_deployment_data.xml b/src/changelog/.11.x.x/export_deployment_data.xml
new file mode 100644
index 0000000..662266c
--- /dev/null
+++ b/src/changelog/.11.x.x/export_deployment_data.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns="https://logging.apache.org/xml/ns"
+       xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+       type="changed">
+  <issue id="246" link="https://github.com/apache/logging-parent/pull/246"/>
+  <description format="asciidoc">
+    The `deploy-*-reusable` workflows export the project version and URL of the staging repository as `project-version` and `project-repository-url` workflow outputs.
+  </description>
+</entry>