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

FreeAndNil pushed a commit to branch Feature/305-dotnet-10-build-cleanup
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git

commit 40c2c47661bd1fb8581b47f81f287dbbef9ab876
Author: Jan Friedrich <[email protected]>
AuthorDate: Tue Aug 4 23:34:49 2026 +0200

    Stop the release scripts on failed steps
    
      $ErrorActionPreference does not apply to native commands, so a failing
      dotnet, git, zip, gpg or mvnw was ignored and the artifacts were
      packaged, signed and tagged anyway. Both scripts now set
      $PSNativeCommandUseErrorActionPreference (PowerShell 7.3+).
    
      Also fix build-preview.ps1 outside Windows, where the artifact paths
      handed to gpg used backslashes.
---
 scripts/build-preview.ps1                       | 12 ++++++++++--
 scripts/build-release.ps1                       |  4 ++++
 src/changelog/3.4.0/305-fix-release-scripts.xml | 15 +++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/scripts/build-preview.ps1 b/scripts/build-preview.ps1
index e1fcfbab..a7f0badb 100644
--- a/scripts/build-preview.ps1
+++ b/scripts/build-preview.ps1
@@ -2,11 +2,19 @@ param(
   $Version = '3.4.0',
   $Preview = '1'
 )
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = 'Stop'
+# $ErrorActionPreference alone does not apply to native commands: dotnet, gpg 
and git only set
+# $LASTEXITCODE, so without this a failing build would still be signed and 
tagged.
+# Requires PowerShell 7.3+.
+$PSNativeCommandUseErrorActionPreference = $true
+
 'building ...'
 dotnet build -c Release 
"-p:GeneratePackages=true;PackageVersion=$Version-preview.$Preview" 
$PSScriptRoot/../src/log4net.sln
 'signing ...'
-gpg --armor --output 
$PSScriptRoot\..\build\artifacts\log4net.$Version-preview.$Preview.nupkg.asc 
--detach-sig 
$PSScriptRoot\..\build\artifacts\log4net.$Version-preview.$Preview.nupkg
-gpg --armor --output 
$PSScriptRoot\..\build\artifacts\log4net.Ext.Mail.$Version-preview.$Preview.nupkg.asc
 --detach-sig 
$PSScriptRoot\..\build\artifacts\log4net.Ext.Mail.$Version-preview.$Preview.nupkg
+gpg --armor --output 
$PSScriptRoot/../build/artifacts/log4net.$Version-preview.$Preview.nupkg.asc 
--detach-sig 
$PSScriptRoot/../build/artifacts/log4net.$Version-preview.$Preview.nupkg
+gpg --armor --output 
$PSScriptRoot/../build/artifacts/log4net.Ext.Mail.$Version-preview.$Preview.nupkg.asc
 --detach-sig 
$PSScriptRoot/../build/artifacts/log4net.Ext.Mail.$Version-preview.$Preview.nupkg
 'create tag?'
 pause
 'creating tag ...'
diff --git a/scripts/build-release.ps1 b/scripts/build-release.ps1
index 271129d0..33fc4172 100644
--- a/scripts/build-release.ps1
+++ b/scripts/build-release.ps1
@@ -4,6 +4,10 @@ param(
 
 Set-StrictMode -Version Latest
 $ErrorActionPreference = 'Stop'
+# $ErrorActionPreference alone does not apply to native commands: dotnet, git, 
zip, gpg and mvnw
+# only set $LASTEXITCODE, so without this a failing build would still be 
packaged and signed.
+# Requires PowerShell 7.3+.
+$PSNativeCommandUseErrorActionPreference = $true
 
 function Write-HashAndSignature
 {
diff --git a/src/changelog/3.4.0/305-fix-release-scripts.xml 
b/src/changelog/3.4.0/305-fix-release-scripts.xml
new file mode 100644
index 00000000..657efaad
--- /dev/null
+++ b/src/changelog/3.4.0/305-fix-release-scripts.xml
@@ -0,0 +1,15 @@
+<?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="fixed">
+  <issue id="305" link="https://github.com/apache/logging-log4net/pull/305"/>
+  <description format="asciidoc">
+    fix the release scripts continuing after a failed step: 
`$ErrorActionPreference` does not apply
+    to native commands, so a failing `dotnet`, `git`, `zip`, `gpg` or `mvnw` 
went unnoticed and the
+    artifacts were packaged, signed and tagged anyway. Both 
`scripts/build-preview.ps1` and
+    `scripts/build-release.ps1` now set 
`$PSNativeCommandUseErrorActionPreference`. Also fix
+    `scripts/build-preview.ps1` outside Windows, where the artifact paths 
handed to `gpg` were
+    built with backslashes, which are not path separators on Linux or macOS
+  </description>
+</entry>

Reply via email to