Skip to content

Commit ad8f053

Browse files
authored
Merge pull request #79 from kubevirt-ui/publishToExt
CNV-70979: Publish npm package to @kubevirt-ui-ext
2 parents 1479f6c + 6c0dea8 commit ad8f053

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

.github/workflows/pr_ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Node.js CI
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
branches: ['main']
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: ['20.x', '22.x', '24.x']
15+
steps:
16+
- uses: actions/checkout@v5
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v6
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- run: yarn install --frozen-lockfile --ignore-scripts
22+
- run: yarn build

.github/workflows/release.yaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
name: Node.js Package
22
on:
33
release:
4-
types: [created]
4+
types: [published]
55
jobs:
6-
build:
6+
buildForNpm:
77
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
id-token: write
811
steps:
9-
- uses: actions/checkout@v2
10-
# Setup .npmrc file to publish to npm
11-
- uses: actions/setup-node@v2
12+
- uses: actions/checkout@v5
13+
- name: Change the organization for npm to @kubevirt-ui-ext
14+
run: jq '.name |= sub("@kubevirt-ui/";"@kubevirt-ui-ext/")' package.json > tmp.json && mv tmp.json package.json
15+
- uses: actions/setup-node@v6
1216
with:
13-
node-version: '12.x'
17+
node-version: '20'
1418
registry-url: 'https://registry.npmjs.org'
15-
- run: npm install
16-
- run: npm publish
19+
scope: '@kubevirt-ui-ext'
20+
- name: Update npm for Trusted Publishing
21+
run: npm install -g npm@'>=11.5.1'
22+
- run: |
23+
npm version
24+
yarn install --frozen-lockfile --ignore-scripts
25+
- run: yarn build
26+
- run: npm publish --provenance --access public
1727
env:
18-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_FOR_KUBEVIRT_UI_EXT }}

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"eslint-plugin-simple-import-sort": "^7.0.0",
9090
"eslint-plugin-unused-imports": "^2.0.0",
9191
"prettier": "^2.5.1",
92-
"rimraf":"6.1.2",
92+
"rimraf": "6.1.2",
9393
"tslint": "^6.1.3",
9494
"tslint-etc": "^1.13.10",
9595
"tsup": "^8.5.0",
@@ -98,10 +98,13 @@
9898
"typescript": "^4.5.5"
9999
},
100100
"sideEffects": false,
101+
"engines": {
102+
"node": ">=20"
103+
},
101104
"tsup": {
102105
"entry": [
103106
"console/index.ts",
104-
"containerized-data-importer/index.ts",
107+
"containerized-data-importer/index.ts",
105108
"kubevirt/index.ts",
106109
"kubernetes/index.ts",
107110
"nmstate/index.ts"
@@ -131,4 +134,4 @@
131134
"url": "https://github.com/kubevirt-ui/kubevirt-api/issues"
132135
},
133136
"homepage": "https://github.com/kubevirt-ui/kubevirt-api#readme"
134-
}
137+
}

0 commit comments

Comments
 (0)