@benshawmean/envedit 1.1.2 → 1.1.3

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.
Files changed (2) hide show
  1. package/.gitlab-ci.yml +23 -12
  2. package/package.json +1 -1
package/.gitlab-ci.yml CHANGED
@@ -11,13 +11,26 @@ default:
11
11
  image: oven/bun:debian
12
12
  before_script:
13
13
  - apt-get update -y > /dev/null
14
- - apt-get install -qy git curl jq build-essential > /dev/null
14
+ - apt-get install -qy git curl jq build-essential just > /dev/null
15
15
  - curl -sSf https://sh.rustup.rs | bash -s -- -y -q > /dev/null
16
16
  - . "$HOME/.cargo/env"
17
17
  - bun install --quiet
18
18
 
19
+ variables:
20
+ GLAB_NPM_REG: //${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/
21
+ VERSION_REGEX: /^v\d+\.\d+\.\d+(-\S*)?$/
22
+ NO_CI_REGEX: /(no|skip)\s+(ci|pipeline)/mi
23
+
19
24
  test:
20
25
  stage: test
26
+ rules:
27
+ - if: $CI_COMMIT_TAG || $CI_COMMIT_MESSAGE =~ $VERSION_REGEX
28
+ when: never
29
+ - if: $CI_COMMIT_DESCRIPTION =~ $NO_CI_REGEX
30
+ when: never
31
+ - if: $CI_COMMIT_BRANCH
32
+ when: always
33
+ allow_failure: false
21
34
  script:
22
35
  - bun test
23
36
  - sed 's/amp;//' coverage/junit.xml > coverage/junit.xml.tmp # remove amp; from junit report to prevent gitlab parsing issues
@@ -40,26 +53,24 @@ deploy:
40
53
  NPM_ID_TOKEN:
41
54
  aud: "npm:registry.npmjs.org"
42
55
  rules:
43
- - if: $CI_COMMIT_REF_PROTECTED && $CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(-\S*)?$/
56
+ - if: $CI_COMMIT_REF_PROTECTED && $CI_COMMIT_TAG && $CI_COMMIT_TAG =~ $VERSION_REGEX
57
+ - if: $CI_COMMIT_DESCRIPTION =~ $NO_CI_REGEX
58
+ when: never
44
59
  script:
45
- - |
60
+ - | # Setup environment variables for deployment
46
61
  export PACKAGE_NAME=$(jq -r '.name' package.json)
47
62
  export CURR_VER=$(jq -r '.version' package.json)
48
63
  export LIVE_VER=$(bun info $PACKAGE_NAME version)
64
+
65
+ - | # Check if the current version is already published
49
66
  if [ "$LIVE_VER" == "$CURR_VER" ]; then
50
67
  echo "Version $CURR_VER is already published. Skipping deployment."
51
68
  exit 9001
52
69
  fi
53
70
 
54
- - bun pm pack --filename package.tgz
55
-
56
- # Publish the package to npm
57
- - bunx npm publish package.tgz
58
-
59
- # Publish the package to GitLab's npm registry
60
- - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" > .npmrc
61
- - echo "@benshawmean:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" >> .npmrc
62
- - bun publish
71
+ - | # Publish to npm and GitLab registries
72
+ echo "${GLAB_NPM_REG}:_authToken=${CI_JOB_TOKEN}" > .npmrc
73
+ just publish
63
74
  allow_failure:
64
75
  exit_codes:
65
76
  - 9001
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@benshawmean/envedit",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "1.1.2",
5
+ "version": "1.1.3",
6
6
  "license": "GPL-3.0-only",
7
7
  "bin": {
8
8
  "envedit": "index.ts"