Skip to content

Commit bfcf4d4

Browse files
committed
build: update publishing config
1 parent d0c106c commit bfcf4d4

File tree

9 files changed

+7135
-6417
lines changed

9 files changed

+7135
-6417
lines changed

.github/workflows/commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: "Validate PR/Push"
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
env:
1010
HUSKY_SKIP: true
@@ -23,7 +23,7 @@ jobs:
2323
if: "! contains(github.event.head_commit.message, '[skip ci]')"
2424
strategy:
2525
matrix:
26-
node-version: [16.x, 18.x, 20.x, 22.x]
26+
node-version: [18.x, 20.x, 22.x, 24.x]
2727
steps:
2828
- uses: actions/checkout@v3
2929
- name: Use Node.js ${{ matrix.node-version }}

.github/workflows/publish.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
7+
workflow_dispatch: # Manual trigger
8+
# inputs:
9+
# confirm:
10+
# description: "Type YES to confirm manual publishing"
11+
# required: true
12+
# default: "NO"
13+
14+
env:
15+
HUSKY_SKIP: true
16+
17+
permissions:
18+
contents: read
19+
id-token: write # REQUIRED for npm trusted publishing
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
steps:
25+
# ------------------------------------------------------------
26+
# Project checkout
27+
# ------------------------------------------------------------
28+
- name: Checkout (no history)
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
# ------------------------------------------------------------
34+
# Setup Node.js environment
35+
# ------------------------------------------------------------
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 24
40+
registry-url: https://registry.npmjs.org
41+
42+
# ------------------------------------------------------------
43+
# Detect auth method
44+
# ------------------------------------------------------------
45+
- name: Detect token usage (optional safety)
46+
run: |
47+
if npm whoami 2>/dev/null; then
48+
echo "::warning::Token-based auth active (expected only for first publish)"
49+
else
50+
echo "OIDC auth active"
51+
fi
52+
53+
# ------------------------------------------------------------
54+
# Install dependencies
55+
# ------------------------------------------------------------
56+
- name: Install dependencies
57+
run: npm ci
58+
59+
# ------------------------------------------------------------
60+
# Bootstrap auth (only needed for first publish per package)
61+
# ------------------------------------------------------------
62+
- name: Configure npm bootstrap token
63+
if: secrets.NPM_BOOTSTRAP_TOKEN != ''
64+
run: |
65+
echo "//registry.npmjs.org/:_authToken=${NPM_BOOTSTRAP_TOKEN}" >> ~/.npmrc
66+
env:
67+
NPM_BOOTSTRAP_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
68+
69+
# ------------------------------------------------------------
70+
# Safety check for manual publishing
71+
# ------------------------------------------------------------
72+
#- name: Verify manual confirmation
73+
# if: github.event_name == 'workflow_dispatch'
74+
# run: |
75+
# if [ "${{ inputs.confirm }}" != "YES" ]; then
76+
# echo "::error::Manual publish not confirmed"
77+
# exit 1
78+
# fi
79+
80+
# ------------------------------------------------------------
81+
# Publish
82+
# ------------------------------------------------------------
83+
- name: Publish packages
84+
env:
85+
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
86+
run: |
87+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
88+
echo "Manual trigger → running release:publish-manual"
89+
npm run release:publish-manual
90+
else
91+
echo "Automatic trigger → running release:publish"
92+
npm run release:publish
93+
fi

.github/workflows/release-auto.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/release-manual.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)