From 8dfb7e1e0af0c33cd8888411e443c1871c64d0dd Mon Sep 17 00:00:00 2001 From: iexitdev Date: Sun, 26 Apr 2026 18:15:25 -0400 Subject: [PATCH] ci: add npm publish workflow --- .github/workflows/publish.yml | 44 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..46cccb9e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish to npm + +on: + workflow_dispatch: + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + + - name: Install dependencies + run: npm install --legacy-peer-deps --ignore-scripts + + - name: Build + run: npm run build + + - name: Typecheck + run: npm run typecheck + + - name: Verify package is unpublished + run: | + PACKAGE_NAME=$(node -p "require('./package.json').name") + PACKAGE_VERSION=$(node -p "require('./package.json').version") + + if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version >/dev/null 2>&1; then + echo "${PACKAGE_NAME}@${PACKAGE_VERSION} is already published" + exit 1 + fi + + - name: Publish + run: npm publish diff --git a/package.json b/package.json index de52ebe3..87ff92b8 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "homepage": "https://github.com/indiespirit/react-native-chart-kit", "repository": { "type": "git", - "url": "https://github.com/indiespirit/react-native-chart-kit" + "url": "git+https://github.com/indiespirit/react-native-chart-kit.git" }, "overrides": { "@types/react": "16.14.8"