Skip to content

Commit 8dfb7e1

Browse files
committed
ci: add npm publish workflow
1 parent c11fb94 commit 8dfb7e1

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 24
22+
registry-url: https://registry.npmjs.org
23+
24+
- name: Install dependencies
25+
run: npm install --legacy-peer-deps --ignore-scripts
26+
27+
- name: Build
28+
run: npm run build
29+
30+
- name: Typecheck
31+
run: npm run typecheck
32+
33+
- name: Verify package is unpublished
34+
run: |
35+
PACKAGE_NAME=$(node -p "require('./package.json').name")
36+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
37+
38+
if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version >/dev/null 2>&1; then
39+
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} is already published"
40+
exit 1
41+
fi
42+
43+
- name: Publish
44+
run: npm publish

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"homepage": "https://github.com/indiespirit/react-native-chart-kit",
6767
"repository": {
6868
"type": "git",
69-
"url": "https://github.com/indiespirit/react-native-chart-kit"
69+
"url": "git+https://github.com/indiespirit/react-native-chart-kit.git"
7070
},
7171
"overrides": {
7272
"@types/react": "16.14.8"

0 commit comments

Comments
 (0)