diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e460dc1..b2027f7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,4 +1,4 @@ -name: Publish JSR +name: Publish on: push: @@ -28,10 +28,15 @@ jobs: run: pnpm run build - name: Test run: pnpm run test + - name: Upload Build as artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: ./dist - publish: + publish-jsr: runs-on: ubuntu-latest - environment: Production + environment: jsr needs: build permissions: contents: read @@ -39,3 +44,25 @@ jobs: steps: - uses: actions/checkout@v4 - run: npx jsr publish + + publish-npm: + runs-on: ubuntu-latest + environment: npm + needs: build + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - name: Download dist artifact + uses: actions/download-artifact@v2 + with: + name: dist + - run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} diff --git a/.npmignore b/.npmignore index 7b988e7..af4f06a 100644 --- a/.npmignore +++ b/.npmignore @@ -6,3 +6,4 @@ src .prettierrc tsconfig.json vite.config.ts +jsr.json diff --git a/jsr.json b/jsr.json index 7cf3e70..197e946 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@rathod-sahaab/http-result", - "version": "0.5.3", + "version": "0.5.4", "exports": { ".": "./src/index.ts" "./ts-rest": "./src/ts-rest/index.ts" diff --git a/package.json b/package.json index 13048c3..a3cb8f2 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "error-handling" ], "private": false, - "version": "0.5.3", + "version": "0.5.4", "type": "module", "main": "./dist/http-result.umd.cjs", "module": "./dist/http-result.js",