From 798c640e6ccd00fce1914e81d6a34c9dfe77197c Mon Sep 17 00:00:00 2001 From: Eric Sitarz Date: Fri, 25 Sep 2026 10:01:08 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20npm=20publish=20on=20merge?= =?UTF-8?q?=20to=20master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authenticate to the npm registry, keep the changelog body intact, and skip publish when the version tag already exists. --- .github/workflows/tag-and-publish.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tag-and-publish.yml b/.github/workflows/tag-and-publish.yml index 1d4ef50d..8db826ea 100644 --- a/.github/workflows/tag-and-publish.yml +++ b/.github/workflows/tag-and-publish.yml @@ -18,6 +18,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 + registry-url: https://registry.npmjs.org - name: Install Dependencies run: npm i @@ -64,10 +65,15 @@ jobs: $changelogContent = $changelogContent -replace "# \[\d+\.\d+\.\d+\] - \d{4}-\d{2}-\d{2}\s*", "" Write-Host "Changelog entry for version $version found!" - Write-Host "Changelog content: $changelogContent" + Write-Host "Changelog content: $changelogContent" - # Store the changelog content in the GITHUB_ENV variable - echo "changelog_content=$changelogContent" >> $env:GITHUB_OUTPUT + # Multiline values must use a delimiter. A single echo drops newlines + # and can break the following release step. The closing delimiter + # cannot be indented, so write the three parts separately. + $changelogContent = $changelogContent -replace "`r", "" + Add-Content -Path $env:GITHUB_OUTPUT -Value "changelog_content<