@krx3d/tizentube2 1.31.450 → 1.31.470
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -167,9 +167,13 @@ concurrency:
|
|
|
167
167
|
group: ${{ github.workflow }}
|
|
168
168
|
cancel-in-progress: false
|
|
169
169
|
|
|
170
|
-
#
|
|
170
|
+
# contents: write to push the version bump back; id-token: write so npm can
|
|
171
|
+
# mint a short-lived OIDC credential and publish as a trusted publisher
|
|
172
|
+
# instead of using a long-lived token. Without id-token the publish falls
|
|
173
|
+
# back to looking for a token and fails.
|
|
171
174
|
permissions:
|
|
172
175
|
contents: write
|
|
176
|
+
id-token: write
|
|
173
177
|
|
|
174
178
|
env:
|
|
175
179
|
PACKAGE_NAME: '@krx3d/tizentube2'
|
|
@@ -218,6 +222,12 @@ jobs:
|
|
|
218
222
|
uses: actions/setup-node@v6
|
|
219
223
|
with:
|
|
220
224
|
node-version: ${{ env.NODE_VERSION }}
|
|
225
|
+
# Required for trusted publishing: this is what puts registry.npmjs.org
|
|
226
|
+
# into .npmrc so npm knows where to present its OIDC credential. It
|
|
227
|
+
# also writes an _authToken line that reads NODE_AUTH_TOKEN, which is
|
|
228
|
+
# deliberately unset for the publish (so OIDC is used) and set only on
|
|
229
|
+
# the cleanup steps further down, which still need a real token.
|
|
230
|
+
registry-url: 'https://registry.npmjs.org'
|
|
221
231
|
|
|
222
232
|
# ----------------------------
|
|
223
233
|
# Version bump (push to main only) - MUST happen BEFORE building dist
|
|
@@ -418,20 +428,24 @@ jobs:
|
|
|
418
428
|
# --------------------
|
|
419
429
|
# NPM AUTH
|
|
420
430
|
# --------------------
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
# No npm auth step before publishing any more.
|
|
432
|
+
#
|
|
433
|
+
# It wrote a token into ~/.npmrc and then ran `npm whoami` as a health
|
|
434
|
+
# check, and on 6 November that check is what failed the release: the
|
|
435
|
+
# token had expired and whoami returned 401 after dist/ and the version
|
|
436
|
+
# bump had already been committed to main. A long-lived publish token is
|
|
437
|
+
# also on npm's way out -- a granular token with "bypass 2FA" loses
|
|
438
|
+
# direct publish around January 2027.
|
|
439
|
+
#
|
|
440
|
+
# Trusted publishing replaces it. npm mints a short-lived credential from
|
|
441
|
+
# the OIDC token this job requests, so there is nothing to expire and
|
|
442
|
+
# nothing to rotate. whoami is not even a valid check for it -- npm's own
|
|
443
|
+
# documentation says so -- which is the other reason this step is gone.
|
|
444
|
+
#
|
|
445
|
+
# It still has to be configured once on npm, under
|
|
446
|
+
# Packages -> @krx3d/tizentube2 -> Settings -> Trusted publishing, naming
|
|
447
|
+
# this repository and this workflow file, with direct publish allowed.
|
|
448
|
+
# Staged publishing alone is not enough for `npm publish` below.
|
|
435
449
|
|
|
436
450
|
# --------------------
|
|
437
451
|
# PUBLISH
|
|
@@ -465,6 +479,23 @@ jobs:
|
|
|
465
479
|
fi
|
|
466
480
|
echo "dist/userScript.js carries ${VER}"
|
|
467
481
|
|
|
482
|
+
# Trusted publishing needs npm 11.5.1 or newer. node-version 24 resolves
|
|
483
|
+
# to whatever 24.x is current and its bundled npm has moved over time, so
|
|
484
|
+
# this checks rather than assumes: an npm without OIDC support does not
|
|
485
|
+
# explain itself, it just fails to authenticate.
|
|
486
|
+
- name: Ensure npm can use trusted publishing
|
|
487
|
+
if: success()
|
|
488
|
+
run: |
|
|
489
|
+
set -euo pipefail
|
|
490
|
+
need=11.5.1
|
|
491
|
+
have=$(npm --version)
|
|
492
|
+
echo "npm ${have} (trusted publishing needs ${need} or newer)"
|
|
493
|
+
if [ "$(printf '%s\n%s\n' "$need" "$have" | sort -V | head -1)" != "$need" ]; then
|
|
494
|
+
echo "Upgrading npm for OIDC support"
|
|
495
|
+
npm install -g npm@latest
|
|
496
|
+
echo "npm now $(npm --version)"
|
|
497
|
+
fi
|
|
498
|
+
|
|
468
499
|
- name: Publish package to npm
|
|
469
500
|
if: success()
|
|
470
501
|
id: publish_npm
|
|
@@ -645,10 +676,43 @@ jobs:
|
|
|
645
676
|
# To actually remove versions today, run
|
|
646
677
|
# scripts/npm-cleanup/unpublish-old-versions.ps1 locally; it prompts for a
|
|
647
678
|
# 2FA code, which is the only path npm still allows.
|
|
648
|
-
|
|
679
|
+
# OIDC covers `npm publish` and nothing else, so the deprecating below
|
|
680
|
+
# still needs a real token -- and npm's package setting decides whether
|
|
681
|
+
# one is accepted at all. Under "Publishing access", the recommended
|
|
682
|
+
# "Require two-factor authentication and disallow bypass 2fa tokens"
|
|
683
|
+
# refuses every token, which leaves deprecation to be done by hand.
|
|
684
|
+
#
|
|
685
|
+
# So a missing or refused token is a warning and a skip, never a failed
|
|
686
|
+
# release: by this point the package is already published and live.
|
|
687
|
+
#
|
|
688
|
+
# whoami is the right check here, where authentication really is a token.
|
|
689
|
+
# It is not a check of trusted publishing, which is why the publish above
|
|
690
|
+
# no longer uses it.
|
|
691
|
+
- name: Check the npm token the cleanup needs
|
|
692
|
+
id: cleanup_auth
|
|
649
693
|
if: steps.confirm_publish.outputs.confirmed == 'true'
|
|
694
|
+
env:
|
|
695
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
696
|
+
run: |
|
|
697
|
+
set -euo pipefail
|
|
698
|
+
if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
|
|
699
|
+
echo "ok=false" >> "$GITHUB_OUTPUT"
|
|
700
|
+
echo "::warning::NPM_TOKEN is not set, so old versions will not be deprecated. The publish itself used trusted publishing and is unaffected."
|
|
701
|
+
exit 0
|
|
702
|
+
fi
|
|
703
|
+
if npm whoami > /dev/null 2>&1; then
|
|
704
|
+
echo "ok=true" >> "$GITHUB_OUTPUT"
|
|
705
|
+
echo "Token accepted; cleanup can deprecate."
|
|
706
|
+
else
|
|
707
|
+
echo "ok=false" >> "$GITHUB_OUTPUT"
|
|
708
|
+
echo "::warning::NPM_TOKEN was refused by the registry, so old versions will not be deprecated. The publish itself used trusted publishing and is unaffected. Either the token expired, or this package now disallows bypass-2fa tokens."
|
|
709
|
+
fi
|
|
710
|
+
|
|
711
|
+
- name: Unpublish old versions (verified) and fallback to deprecate
|
|
712
|
+
if: steps.confirm_publish.outputs.confirmed == 'true' && steps.cleanup_auth.outputs.ok == 'true'
|
|
650
713
|
env:
|
|
651
714
|
PKG: ${{ env.PACKAGE_NAME }}
|
|
715
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
652
716
|
run: |
|
|
653
717
|
set -euo pipefail
|
|
654
718
|
|
|
@@ -736,9 +800,10 @@ jobs:
|
|
|
736
800
|
# DEPRECATE older (>72h)
|
|
737
801
|
# --------------------
|
|
738
802
|
- name: Deprecate older versions
|
|
739
|
-
if: steps.confirm_publish.outputs.confirmed == 'true'
|
|
803
|
+
if: steps.confirm_publish.outputs.confirmed == 'true' && steps.cleanup_auth.outputs.ok == 'true'
|
|
740
804
|
env:
|
|
741
805
|
PKG: ${{ env.PACKAGE_NAME }}
|
|
806
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
742
807
|
run: |
|
|
743
808
|
set -euo pipefail
|
|
744
809
|
if [ ! -s /tmp/to_deprecate.txt ]; then
|