mbkauthe 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ npm install mbkauthe
10
10
 
11
11
  ## Version
12
12
 
13
- Current Version: 1.4.1
13
+ Current Version: 1.4.2
14
14
 
15
15
  ## Registry
16
16
 
@@ -1,4 +1,4 @@
1
- name: Publish to npm
1
+ name: Publish to npm and GitHub Packages
2
2
  on:
3
3
  push:
4
4
  branches:
@@ -36,19 +36,52 @@ jobs:
36
36
  run: |
37
37
  for i in {1..3}; do npm install && break || sleep 10; done
38
38
 
39
+ - name: Check if version exists on npm
40
+ id: check_version
41
+ run: |
42
+ PACKAGE_NAME=$(node -p "require('./package.json').name")
43
+ VERSION=$(node -p "require('./package.json').version")
44
+ if npm view $PACKAGE_NAME@$VERSION version 2>/dev/null; then
45
+ echo "exists=true" >> $GITHUB_OUTPUT
46
+ echo "Version $VERSION already exists on npm"
47
+ else
48
+ echo "exists=false" >> $GITHUB_OUTPUT
49
+ echo "Version $VERSION does not exist, will publish"
50
+ fi
51
+
39
52
  - name: Publish to npm
53
+ if: steps.check_version.outputs.exists == 'false'
40
54
  run: npm publish
41
55
  env:
42
56
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43
57
 
58
+ - name: Check if version exists on GitHub Packages
59
+ id: check_github_version
60
+ run: |
61
+ VERSION=$(node -p "require('./package.json').version")
62
+ if curl -f -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
63
+ https://npm.pkg.github.com/@mibnekhalid/mbkauthe/$VERSION 2>/dev/null; then
64
+ echo "exists=true" >> $GITHUB_OUTPUT
65
+ echo "Version $VERSION already exists on GitHub Packages"
66
+ else
67
+ echo "exists=false" >> $GITHUB_OUTPUT
68
+ echo "Version $VERSION does not exist on GitHub Packages, will publish"
69
+ fi
70
+
71
+ - name: Modify package.json for GitHub Packages
72
+ if: steps.check_github_version.outputs.exists == 'false'
73
+ run: |
74
+ node -e "const pkg = require('./package.json'); pkg.name = '@mibnekhalid/mbkauthe'; pkg.publishConfig = { registry: 'https://npm.pkg.github.com' }; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
75
+
44
76
  - name: Setup Node.js for GitHub Packages
77
+ if: steps.check_github_version.outputs.exists == 'false'
45
78
  uses: actions/setup-node@v3
46
79
  with:
47
80
  node-version: '18'
48
81
  registry-url: 'https://npm.pkg.github.com'
49
- scope: '@MIbnEKhalid'
50
82
 
51
83
  - name: Publish to GitHub Packages
84
+ if: steps.check_github_version.outputs.exists == 'false'
52
85
  run: npm publish
53
86
  env:
54
87
  NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/docs/api.md CHANGED
@@ -836,6 +836,6 @@ For issues, questions, or contributions:
836
836
  ---
837
837
 
838
838
  **Last Updated:** November 17, 2025
839
- **Version:** 1.4.1
839
+ **Version:** 1.4.2
840
840
 
841
841
  [← Back to README](../README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbkauthe",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "MBKTechStudio's reusable authentication system for Node.js applications.",
5
5
  "main": "index.js",
6
6
  "type": "module",