forked from plasticrake/homebridge-tplink-smarthome
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.2 KB
/
Copy pathnpm-package.yml
File metadata and controls
52 lines (42 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Deploy to npm
on:
workflow_dispatch:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
- name: Publish to npm
run: |
VERSION=$(node -p "require('./package.json').version")
PACKAGE=$(node -p "require('./package.json').name")
OUTPUT=$(pnpm publish --provenance --access public --no-git-checks 2>&1) || {
if echo "$OUTPUT" | grep -q "cannot publish over the previously published"; then
echo "${PACKAGE}@${VERSION} already published, skipping"
exit 0
fi
echo "$OUTPUT" >&2
exit 1
}
echo "$OUTPUT"