@devopsplaybook.io/common-utils 1.7.0 → 1.8.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.
@@ -21,7 +21,37 @@ on:
21
21
  required: false
22
22
 
23
23
  jobs:
24
+ version-check:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+
29
+ - name: Fetch main branch
30
+ run: git fetch origin main --depth=1
31
+
32
+ - name: Verify version is higher than main
33
+ run: |
34
+ PR_VERSION=$(jq -r '.version' package.json)
35
+ MAIN_VERSION=$(git show origin/main:package.json | jq -r '.version')
36
+
37
+ echo "PR version: ${PR_VERSION}"
38
+ echo "Main version: ${MAIN_VERSION}"
39
+
40
+ if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
41
+ echo "::error::PR version (${PR_VERSION}) must be higher than main branch version (${MAIN_VERSION}). Please bump the version in package.json."
42
+ exit 1
43
+ fi
44
+
45
+ HIGHER=$(printf '%s\n%s' "$PR_VERSION" "$MAIN_VERSION" | sort -V | tail -n1)
46
+ if [ "$HIGHER" != "$PR_VERSION" ]; then
47
+ echo "::error::PR version (${PR_VERSION}) is lower than main branch version (${MAIN_VERSION}). Please bump the version in package.json."
48
+ exit 1
49
+ fi
50
+
51
+ echo "Version check passed: ${PR_VERSION} > ${MAIN_VERSION}"
52
+
24
53
  test-and-build:
54
+ needs: version-check
25
55
  runs-on: ubuntu-latest
26
56
 
27
57
  steps:
@@ -29,7 +29,37 @@ on:
29
29
  required: false
30
30
 
31
31
  jobs:
32
+ version-check:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v7
36
+
37
+ - name: Fetch main branch
38
+ run: git fetch origin main --depth=1
39
+
40
+ - name: Verify version is higher than main
41
+ run: |
42
+ PR_VERSION=$(jq -r '.version' package.json)
43
+ MAIN_VERSION=$(git show origin/main:package.json | jq -r '.version')
44
+
45
+ echo "PR version: ${PR_VERSION}"
46
+ echo "Main version: ${MAIN_VERSION}"
47
+
48
+ if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
49
+ echo "::error::PR version (${PR_VERSION}) must be higher than main branch version (${MAIN_VERSION}). Please bump the version in package.json."
50
+ exit 1
51
+ fi
52
+
53
+ HIGHER=$(printf '%s\n%s' "$PR_VERSION" "$MAIN_VERSION" | sort -V | tail -n1)
54
+ if [ "$HIGHER" != "$PR_VERSION" ]; then
55
+ echo "::error::PR version (${PR_VERSION}) is lower than main branch version (${MAIN_VERSION}). Please bump the version in package.json."
56
+ exit 1
57
+ fi
58
+
59
+ echo "Version check passed: ${PR_VERSION} > ${MAIN_VERSION}"
60
+
32
61
  node-build:
62
+ needs: version-check
33
63
  if: inputs.node_app_directories != ''
34
64
  strategy:
35
65
  matrix:
@@ -106,6 +136,7 @@ jobs:
106
136
  fi
107
137
 
108
138
  docker-build:
139
+ needs: version-check
109
140
  runs-on: ubuntu-latest
110
141
  steps:
111
142
  - uses: actions/checkout@v7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/common-utils",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Shared utility modules for devopsplaybook.io projects (DB, Config, OTel context, auth/users, notifications, LLM, system helpers)",
5
5
  "keywords": [
6
6
  "Open Telemetry",