Skip to content

Commit 2ded6e4

Browse files
committed
build: update publish process
1 parent e1f5e8d commit 2ded6e4

File tree

8 files changed

+2871
-4393
lines changed

8 files changed

+2871
-4393
lines changed

.eslintignore

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

.eslintrc.json

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

.github/workflows/publish.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish
2+
3+
# Trigger on tag push AND manual trigger
4+
on:
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
workflow_dispatch: # Manual trigger
9+
10+
permissions:
11+
contents: read
12+
id-token: write # REQUIRED for trusted publishing (OIDC)
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: "npm"
25+
registry-url: "https://registry.npmjs.org/"
26+
27+
- name: Read package name
28+
id: pkg
29+
run: |
30+
echo "NAME=$(jq -r '.name' package.json)" >> $GITHUB_ENV
31+
32+
- name: Decide publish method
33+
run: |
34+
if npm view "$NAME" > /dev/null 2>&1; then
35+
echo "EXISTS=true" >> $GITHUB_ENV
36+
echo "Package exists → using trusted publishing"
37+
else
38+
echo "EXISTS=false" >> $GITHUB_ENV
39+
echo "Package does not exist → bootstrap publish"
40+
fi
41+
42+
- name: Publish
43+
env:
44+
NPM_BOOTSTRAP_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
45+
run: |
46+
if [ "$EXISTS" = "false" ]; then
47+
echo "//registry.npmjs.org/:_authToken=${NPM_BOOTSTRAP_TOKEN}" > ~/.npmrc
48+
fi
49+
50+
npm publish --access public
51+
52+
if [ "$EXISTS" = "false" ]; then
53+
rm ~/.npmrc
54+
fi

.github/workflows/release-auto.yml

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

.husky/skip.js

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

eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const globals = require("globals");
2+
const js = require("@eslint/js");
3+
4+
module.exports = [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
globals: {
9+
...globals.browser,
10+
sap: "readonly",
11+
},
12+
ecmaVersion: 2023,
13+
sourceType: "script",
14+
},
15+
rules: {
16+
"prefer-const": "warn",
17+
},
18+
},
19+
{
20+
ignores: ["eslint.config.js"],
21+
},
22+
];

0 commit comments

Comments
 (0)