wdio-test-ledger-service 9.2.3 → 9.2.5

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.
@@ -1,6 +1,9 @@
1
1
  name: Publish to NPM
2
2
 
3
3
  on:
4
+ push:
5
+ branches:
6
+ - master
4
7
  workflow_dispatch:
5
8
  inputs:
6
9
  release_type:
@@ -25,6 +28,7 @@ jobs:
25
28
  with:
26
29
  ref: 'master'
27
30
  fetch-depth: 0
31
+
28
32
  - uses: actions/setup-node@v4
29
33
  with:
30
34
  node-version: '20'
@@ -43,6 +47,16 @@ jobs:
43
47
  - name: Install Dependencies
44
48
  run: npm ci
45
49
 
46
- - run: npm run release -- ${{ github.event.inputs.release_type }}
50
+ - name: Release (manual)
51
+ if: github.event_name == 'workflow_dispatch'
52
+ run: npm run release -- ${{ github.event.inputs.release_type }}
53
+ env:
54
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56
+
57
+ - name: Release (auto patch on push)
58
+ if: github.event_name == 'push'
59
+ run: npm run release -- patch
47
60
  env:
48
61
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.release-it.json CHANGED
@@ -1,5 +1,13 @@
1
1
  {
2
2
  "npm": {
3
+ "publish": true,
3
4
  "skipChecks": true
5
+ },
6
+ "git": {
7
+ "commitMessage": "Release v${version}",
8
+ "tagName": "v${version}"
9
+ },
10
+ "github": {
11
+ "release": false
4
12
  }
5
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-test-ledger-service",
3
- "version": "9.2.3",
3
+ "version": "9.2.5",
4
4
  "description": "WebdriverIO server to send reporter data to testledger.dev",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -8,7 +8,7 @@
8
8
  "node": "20.x"
9
9
  },
10
10
  "scripts": {
11
- "release": "release-it --github.release"
11
+ "release": "release-it"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
package/src/index.js CHANGED
@@ -25,12 +25,12 @@ class TestLedgerLauncher {
25
25
  throw new SevereServiceError(`No reporterOutputDir specified`)
26
26
  }
27
27
 
28
- if(!this.options.username) {
29
- throw new SevereServiceError(`No username specified`)
30
- }
28
+ // Support env vars with fallback to options
29
+ this.apiToken = process.env.TESTLEDGER_API_TOKEN || this.options.apiToken;
30
+ this.username = process.env.TESTLEDGER_USERNAME || this.options.username;
31
31
 
32
- if(!this.options.apiToken) {
33
- throw new SevereServiceError(`No apiToken specified`)
32
+ if(!this.apiToken) {
33
+ throw new SevereServiceError(`No apiToken specified. Set TESTLEDGER_API_TOKEN env var or pass apiToken option.`)
34
34
  }
35
35
 
36
36
  // Artifact upload options
@@ -201,7 +201,7 @@ class TestLedgerLauncher {
201
201
  method : `POST`,
202
202
  headers : {
203
203
  'Content-Type' : `application/json`,
204
- 'Authorization' : `Basic ${this.getAuthToken()}`,
204
+ 'Authorization' : this.getAuthHeader(),
205
205
  },
206
206
  body : JSON.stringify(data),
207
207
  });
@@ -218,11 +218,12 @@ class TestLedgerLauncher {
218
218
  ].join(``);
219
219
  }
220
220
 
221
- getAuthToken() {
222
- return btoa([
223
- this.options.username,
224
- this.options.apiToken,
225
- ].join(`:`));
221
+ getAuthHeader() {
222
+ // Use Bearer auth if no username, otherwise Basic auth for backward compatibility
223
+ if(!this.username) {
224
+ return `Bearer ${this.apiToken}`;
225
+ }
226
+ return `Basic ${btoa(`${this.username}:${this.apiToken}`)}`;
226
227
  }
227
228
 
228
229
  /**
@@ -414,7 +415,7 @@ class TestLedgerLauncher {
414
415
  method : 'POST',
415
416
  headers : {
416
417
  'Content-Type' : 'application/json',
417
- 'Authorization' : `Basic ${this.getAuthToken()}`
418
+ 'Authorization' : this.getAuthHeader()
418
419
  },
419
420
  body : JSON.stringify(payload)
420
421
  });
@@ -477,7 +478,7 @@ class TestLedgerLauncher {
477
478
  method : 'POST',
478
479
  headers : {
479
480
  'Content-Type' : 'application/json',
480
- 'Authorization' : `Basic ${this.getAuthToken()}`
481
+ 'Authorization' : this.getAuthHeader()
481
482
  },
482
483
  body : JSON.stringify({ artifact_ids: artifact_ids })
483
484
  });