violetics 7.0.6-alpha → 7.0.7-alpha

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.
@@ -0,0 +1,75 @@
1
+ name: Publish Package to npmjs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - master
12
+ release:
13
+ types: [published]
14
+ workflow_dispatch:
15
+
16
+ jobs:
17
+ publish:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: write
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v4
24
+ with:
25
+ token: ${{ secrets.GITHUB_TOKEN }}
26
+
27
+ - name: Setup Node.js
28
+ uses: actions/setup-node@v4
29
+ with:
30
+ node-version: '20.x'
31
+ registry-url: 'https://registry.npmjs.org'
32
+
33
+ - name: Enable Corepack
34
+ run: corepack enable
35
+
36
+ - name: Install dependencies
37
+ run: yarn install --no-immutable
38
+
39
+ - name: Auto bump patch version
40
+ if: github.event_name != 'pull_request'
41
+ run: |
42
+ # Get latest published version from NPM (fallback to package.json if not published yet)
43
+ PUBLISHED=$(npm view ${{ github.event.repository.name }} version 2>/dev/null || node -p "require('./package.json').version")
44
+ echo "Latest published version: $PUBLISHED"
45
+
46
+ # Split into parts: major.minor.patch[-prerelease]
47
+ BASE=$(echo $PUBLISHED | sed 's/-.*//') # strip pre-release suffix
48
+ PRE=$(echo $PUBLISHED | grep -o '\-.*' || true) # keep pre-release suffix if any
49
+
50
+ MAJOR=$(echo $BASE | cut -d. -f1)
51
+ MINOR=$(echo $BASE | cut -d. -f2)
52
+ PATCH=$(echo $BASE | cut -d. -f3)
53
+
54
+ NEW_PATCH=$((PATCH + 1))
55
+ NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${PRE}"
56
+ echo "New version: $NEW_VERSION"
57
+
58
+ # Write new version to package.json
59
+ npm version $NEW_VERSION --no-git-tag-version
60
+
61
+ # Commit updated package.json back to repo
62
+ git config user.name "github-actions[bot]"
63
+ git config user.email "github-actions[bot]@users.noreply.github.com"
64
+ git add package.json
65
+ git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
66
+ git push
67
+ env:
68
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69
+
70
+ - name: Publish to npmjs
71
+ if: github.event_name != 'pull_request'
72
+ run: npm publish
73
+ env:
74
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
75
+