Skip to content

Commit a97a2e5

Browse files
authored
Add NPM release automation workflow (#60)
1 parent 635df62 commit a97a2e5

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

.github/workflows/release-npm.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release NPM
2+
3+
permissions:
4+
contents: write
5+
id-token: write
6+
7+
on:
8+
push:
9+
tags:
10+
- "v*"
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: lts/*
22+
registry-url: https://registry.npmjs.org/
23+
- uses: pnpm/action-setup@v4
24+
- run: pnpm install
25+
- name: Upgrade npm
26+
run: npm i -g npm@latest
27+
- name: Publish to NPM
28+
run: pnpm run publish

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"check": "biome check --write",
1717
"example:dev": "pnpm -C packages/search-widget dev",
1818
"prepare": "husky",
19-
"release:packages": "pnpm -r run release"
19+
"publish": "pnpm -r publish --access public --no-git-checks"
2020
},
2121
"lint-staged": {
2222
"*": [

packages/search-widget/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"dev": "vite --config vite.config.dev.ts",
2121
"build": "vite build --config vite.config.lib.ts",
2222
"lint": "lit-analyzer && eslint 'src/**/*.ts' --fix",
23-
"prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.gitignore --write"
23+
"prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.gitignore --write",
24+
"prepublishOnly": "pnpm run build"
2425
},
2526
"dependencies": {
2627
"@lit/localize": "^0.12.2",

packages/widget/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"private": true,
23
"scripts": {
34
"build": "tsc && vite build",
45
"dev": "vite",

0 commit comments

Comments
 (0)