Skip to content

Commit effc51c

Browse files
committed
feat: improve publish workflow with tests and caching
Changes: - Changed trigger from 'created' to 'published' (more standard) - Added test run before publishing to ensure quality - Added npm cache for faster dependency installation - Tests must pass before package is published to npm To use this workflow: 1. Go to GitHub Settings > Secrets and variables > Actions 2. Add a new secret named NPM_TOKEN 3. Get your npm automation token from https://www.npmjs.com/settings/tokens 4. Create releases on GitHub and they will auto-publish to npm
1 parent 29a13af commit effc51c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish to npm
22

33
on:
44
release:
5-
types: [created]
5+
types: [published]
66

77
jobs:
88
publish:
@@ -16,10 +16,14 @@ jobs:
1616
with:
1717
node-version: '20.x'
1818
registry-url: 'https://registry.npmjs.org'
19+
cache: 'npm'
1920

2021
- name: Install dependencies
2122
run: npm ci
2223

24+
- name: Run tests
25+
run: npm run test:run
26+
2327
- name: Build
2428
run: npm run build
2529

0 commit comments

Comments
 (0)