genkode 1.2.0 → 1.3.0

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.
@@ -33,14 +33,18 @@ jobs:
33
33
  run: npm test
34
34
 
35
35
  publish:
36
- name: Publish to npm
36
+ name: Auto Version & Publish
37
37
  runs-on: ubuntu-latest
38
38
  needs: build-and-test
39
- if: github.ref == 'refs/heads/master'
39
+ if: "github.ref == 'refs/heads/master'"
40
+ permissions:
41
+ contents: write
40
42
 
41
43
  steps:
42
44
  - name: Checkout code
43
45
  uses: actions/checkout@v4
46
+ with:
47
+ fetch-depth: 0
44
48
 
45
49
  - name: Setup Node
46
50
  uses: actions/setup-node@v4
@@ -54,6 +58,37 @@ jobs:
54
58
  - name: Build project
55
59
  run: npm run build
56
60
 
61
+ - name: Configure Git
62
+ run: |
63
+ git config user.name "github-actions"
64
+ git config user.email "github-actions@github.com"
65
+
66
+ - name: Determine version bump
67
+ id: version
68
+ run: |
69
+ MSG="$(git log -1 --pretty=%B)"
70
+
71
+ if [[ "$MSG" == *"BREAKING"* ]]; then
72
+ echo "type=major" >> "$GITHUB_OUTPUT"
73
+ elif [[ "$MSG" == *"feat"* ]]; then
74
+ echo "type=minor" >> "$GITHUB_OUTPUT"
75
+ else
76
+ echo "type=patch" >> "$GITHUB_OUTPUT"
77
+ fi
78
+
79
+ - name: Stage build output
80
+ run: |
81
+ git add -A
82
+ git diff --cached --quiet || git commit -m "chore: build output"
83
+
84
+ - name: Bump version
85
+ run: 'npm version ${{ steps.version.outputs.type }} -m "release: %s"'
86
+
87
+ - name: Push version commit
88
+ run: git push origin master --follow-tags
89
+ env:
90
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91
+
57
92
  - name: Publish to npm
58
93
  run: npm publish
59
94
  env:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genkode",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A lightweight Node.js utility to generate random alphanumeric, alphabetic, or numeric strings.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",