@benshawmean/envedit 1.1.0 → 1.1.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.
package/.gitlab-ci.yml CHANGED
@@ -1,44 +1,65 @@
1
1
  stages:
2
2
  - test
3
- - build
4
3
  - deploy
5
4
 
6
5
  workflow:
7
6
  rules:
8
7
  - if: $CI_COMMIT_BRANCH
8
+ - if: $CI_COMMIT_TAG
9
9
 
10
10
  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 > /dev/null
15
- - bun i
14
+ - apt-get install -qy git curl jq build-essential > /dev/null
15
+ - curl -sSf https://sh.rustup.rs | bash -s -- -y -q > /dev/null
16
+ - . "$HOME/.cargo/env"
17
+ - bun install --quiet
16
18
 
17
- .deploy: &deploy
18
- stage: deploy
19
- id_tokens:
20
- SIGSTORE_ID_TOKEN:
21
- aud: sigstore
22
- rules:
23
- - if: $CI_COMMIT_REF_PROTECTED == 'true'
24
- when: manual
19
+ test:
20
+ stage: test
21
+ script:
22
+ - bun test
23
+ - sed 's/amp;//' coverage/junit.xml > coverage/junit.xml.tmp # remove amp; from junit report to prevent gitlab parsing issues
24
+ - mv coverage/junit.xml.tmp coverage/junit.xml # make the change permanent
25
+ - cargo install -q lcov2xml # used to convert lcov output to cobertura-xml for gitlab code coverage parsing
26
+ - lcov2xml coverage/lcov.info -o coverage/cobertura-coverage.xml
27
+ coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
28
+ artifacts:
29
+ reports:
30
+ junit: ./coverage/junit.xml
31
+ coverage_report:
32
+ coverage_format: cobertura
33
+ path: ./coverage/cobertura-coverage.xml
25
34
 
26
- deploy npm:
27
- <<: *deploy
28
- # Bun seems to struggle publishing to npm on the CI job, so we'll use npm for this one
29
- image: node:latest
30
- before_script: [] # skip the default before_script
35
+ deploy:
36
+ stage: deploy
31
37
  id_tokens:
32
38
  SIGSTORE_ID_TOKEN:
33
39
  aud: sigstore
34
40
  NPM_ID_TOKEN:
35
41
  aud: "npm:registry.npmjs.org"
42
+ rules:
43
+ - if: $CI_COMMIT_REF_PROTECTED && $CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(-\S*)?$/
36
44
  script:
37
- - npm publish
45
+ - |
46
+ export PACKAGE_NAME=$(jq -r '.name' package.json)
47
+ export CURR_VER=$(jq -r '.version' package.json)
48
+ export LIVE_VER=$(bun info $PACKAGE_NAME version)
49
+ if [ "$LIVE_VER" == "$CURR_VER" ]; then
50
+ echo "Version $CURR_VER is already published. Skipping deployment."
51
+ exit 9001
52
+ fi
38
53
 
39
- deploy gitlab:
40
- <<: *deploy
41
- script:
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
42
60
  - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" > .npmrc
43
61
  - echo "@benshawmean:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" >> .npmrc
44
62
  - bun publish
63
+ allow_failure:
64
+ exit_codes:
65
+ - 9001