You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2024/04/08 02:12:25 UTC

(logging-log4cxx) branch master updated: Improve release process repeatability (#363)

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

swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


The following commit(s) were added to refs/heads/master by this push:
     new 4632af8f Improve  release process repeatability (#363)
4632af8f is described below

commit 4632af8fc4a4973b858e82ff01aefd07fe1c45c4
Author: Stephen Webb <st...@ieee.org>
AuthorDate: Mon Apr 8 12:12:20 2024 +1000

    Improve  release process repeatability (#363)
    
    * Only a push to master requires release package generation
---
 .github/workflows/package_code.yml | 67 ++++++++++++++++++++++++++++++++++++++
 CMakeLists.txt                     | 15 ++++++---
 2 files changed, 77 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/package_code.yml b/.github/workflows/package_code.yml
new file mode 100644
index 00000000..31b48498
--- /dev/null
+++ b/.github/workflows/package_code.yml
@@ -0,0 +1,67 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+name: Generate release files
+
+on:
+  push:
+    branches:
+      - master
+#  pull_request:
+#    branches:
+#      - master
+
+jobs:
+  job1:
+    name: 'Package code for release'
+    runs-on: ubuntu-20.04
+    timeout-minutes: 38
+    strategy:
+      fail-fast: false
+
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        path: clean-checkout
+
+# Consider using CPack when it supports a white-list for included files
+#    - name: 'Install minimum dependencies'
+#      run: |
+#        sudo apt-get install -y libapr1-dev libaprutil1-dev
+#
+#    - name: 'Create release files'
+#      run: |
+#        cmake -B package -S clean-checkout -DAPACHE_MAINTAINER=yes -DCPACK_PACKAGE_DIRECTORY=`pwd`
+#        cmake --build package --target dist
+#
+    - name: 'Create release files'
+      run: |
+        cd clean-checkout
+        rm -r src/main/abi-symbols
+        VERSION=`grep 'set(log4cxx_VER ' src/cmake/projectVersionDetails.cmake|sed -Ee 's/.*log4cxx_VER ([0-9]*)\.([0-9]*)\.([0-9]*).*/\1.\2.\3/'`
+        tar -zcf "../apache-log4cxx-$VERSION.tar.gz" "--transform=s,^,apache-log4cxx-$VERSION/," INSTALL  LICENSE  NOTICE  README.md  CMakeLists.txt  src  liblog4cxx.pc.in  liblog4cxx-qt.pc.in  KEYS
+        cd ..
+        sha512sum "apache-log4cxx-$VERSION.tar.gz" > "apache-log4cxx-$VERSION.tar.gz.sha512"
+        sha256sum "apache-log4cxx-$VERSION.tar.gz" > "apache-log4cxx-$VERSION.tar.gz.sha256"
+        tar xf "apache-log4cxx-$VERSION.tar.gz"
+        zip -rm "apache-log4cxx-$VERSION.zip" apache-log4cxx-$VERSION
+        sha512sum "apache-log4cxx-$VERSION.zip" > "apache-log4cxx-$VERSION.zip.sha512"
+        sha256sum "apache-log4cxx-$VERSION.zip" > "apache-log4cxx-$VERSION.zip.sha256"
+
+    - uses: actions/upload-artifact@v2
+      if: always()
+      with:
+        name: 'Upload release files'
+        path: |
+          apache-log4cxx-*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0af9905..21a018bb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -265,15 +265,20 @@ option(APACHE_MAINTAINER "Apache maintainer" OFF)
 if(APACHE_MAINTAINER)
     set(CPACK_SOURCE_PACKAGE_FILE_NAME "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}")
     set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
-    set(CPACK_SOURCE_IGNORE_FILES ".git/;build/;.vs/;out/;CMakeLists.txt.user;src/main/abi-symbols/*;src/test/resources/output/")
+    set(CPACK_SOURCE_IGNORE_FILES ".git/;.github/;.gitattributes;.gitignore;.vs/;out/;build/;sonar-project.properties;doap_log4cxx.rdf;CMakeLists.txt.user;src/main/abi-symbols/;src/test/resources/output/")
     include(CPack)
+    if(CPACK_PACKAGE_DIRECTORY)
+      set(LOG4CXX_PACKAGE_FILEPATH_PREFIX "${CPACK_PACKAGE_DIRECTORY}/${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+    else()
+      set(LOG4CXX_PACKAGE_FILEPATH_PREFIX "${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+    endif()
 
     add_custom_target( dist
 	COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} -- package_source
-	COMMAND ${CMAKE_COMMAND} -E sha512sum "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.tar.gz" > "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.tar.gz.sha512"
-	COMMAND ${CMAKE_COMMAND} -E sha512sum "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.zip" > "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.zip.sha512"
-	COMMAND gpg -ab --yes "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.tar.gz" > "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.tar.gz.asc"
-	COMMAND gpg -ab --yes "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.zip" > "apache-log4cxx-${LOG4CXX_RELEASE_VERSION}.zip.asc"
+	COMMAND ${CMAKE_COMMAND} -E sha512sum "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.tar.gz" > "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.tar.gz.sha512"
+	COMMAND ${CMAKE_COMMAND} -E sha512sum "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.zip" > "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.zip.sha512"
+	COMMAND gpg --armor --detach-sign --yes --pinentry-mode error "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.tar.gz" > "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.tar.gz.asc"
+	COMMAND gpg --armor --detach-sign --yes --pinentry-mode error "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.zip" > "${LOG4CXX_PACKAGE_FILEPATH_PREFIX}.zip.asc"
 	)
 endif()