Skip to content

Commit 4a4c19e

Browse files
committed
Fix publishing with NPM tag without git tag
For reasons beyond my comprehension, when you assign `default` to a GitHub Action input value, it does _not_ prefill the input with that value when it is missing. I guess we are changing what `default` means?
1 parent 0fffd19 commit 4a4c19e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/release.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ jobs:
188188
with:
189189
submodules: true
190190

191+
- name: Setup Node.js
192+
uses: actions/setup-node@v4
193+
with:
194+
token: ${{ secrets.NPM_TOKEN }}
195+
registry-url: 'https://registry.npmjs.org'
196+
191197
- name: Download artifacts
192198
id: download-artifact
193199
uses: actions/download-artifact@v4
@@ -199,8 +205,10 @@ jobs:
199205
run: |
200206
git config --global user.name 'github-actions[bot]'
201207
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
202-
npm publish --tag ${{ inputs.npm-tag }} --new-version $(echo $VERSION | sed 's/^v//')
208+
npm version --allow-same-version --no-git-tag-version $VERSION
209+
npm publish --tag $TAG
203210
if: ${{ !env.ACT }}
204211
env:
205-
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
212+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
213+
TAG: ${{ inputs.npm-tag || 'latest' }}
206214
VERSION: ${{ inputs.new-version || github.ref_name }}

0 commit comments

Comments
 (0)