Skip to content

Commit

Permalink
feat: publish new version to npm via ci
Browse files Browse the repository at this point in the history
Also, add the exported type structure.

PR: #198
  • Loading branch information
jbergstroem authored Aug 30, 2023
1 parent 465feab commit 15041be
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 72 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/npm-publish.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
release:
types: [published]

env:
lockfile: pnpm-lock.yaml
node_version: "18"
pnpm_version: "8"

jobs:
npm-publish:
name: Publish to NPM
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
name: Install PNPM
id: pnpm-install
with:
version: ${{ env.pnpm_version }}

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
cache: pnpm
cache-dependency-path: ${{ env.lockfile }}

- name: Install dependencies
run: pnpm install

- name: Run ESLint
run: pnpm run lint:ci

- name: Run tests
run: pnpm run test

- name: Run tsc
run: node_modules/.bin/tsc

- name: Build dist
run: pnpm run build

- name: Publish to npm
id: publish
run: |
pnpm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
pnpm publish --access public --no-git-checks
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
"exports": {
".": {
"import": "./dist/ts.mjs",
"require": "./dist/ts.js"
"require": "./dist/ts.js",
"types": "./dist/src/events.d.ts"
}
},
"module": "./dist/ts.js",
"module": "./dist/ts.mjs",
"files": [
"dist/src",
"dist/ts.js",
"dist/ts.mjs",
"dist/*.d.ts",
Expand Down

0 comments on commit 15041be

Please sign in to comment.