Skip to content

Commit 2112d5b

Browse files
committed
Configure GitHub Packages publishing
- Update package name to @r-el/json-file-crud for GitHub Packages - Add publishConfig for GitHub npm registry - Create GitHub Action for automated publishing on release - Enable workflow_dispatch for manual publishing
1 parent fbc5747 commit 2112d5b

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to GitHub Packages
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '18'
22+
registry-url: 'https://npm.pkg.github.com'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Run tests
28+
run: npm test
29+
30+
- name: Run examples
31+
run: npm run examples
32+
33+
- name: Publish to GitHub Packages
34+
run: npm publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
2-
"name": "json-file-crud",
2+
"name": "@r-el/json-file-crud",
33
"version": "1.1.0",
44
"title": "JsonFileCRUD",
55
"description": "A simple, robust, and thread-safe CRUD library for managing JSON objects in files with unique fields, auto-ID, and advanced features",
66
"main": "./lib/json-file-crud.js",
77
"type": "module",
8+
"publishConfig": {
9+
"registry": "https://npm.pkg.github.com"
10+
},
811
"scripts": {
912
"start": "node .",
1013
"test": "node test/test-basic.js && node test/test-read.js && node test/test-create.js && node test/test-update.js && node test/test-delete.js && node test/test-advanced-create.js && node test/test-config-options.js",

0 commit comments

Comments
 (0)