File tree Expand file tree Collapse file tree 9 files changed +75
-39
lines changed Expand file tree Collapse file tree 9 files changed +75
-39
lines changed Original file line number Diff line number Diff line change 11#
22# Publish releases to NPM
33#
4- name : Publish
4+ name : Publish Code
55
66on :
7- release :
8- types : [ published ]
7+ workflow_call :
8+ workflow_dispatch :
99
1010jobs :
1111 publish :
Original file line number Diff line number Diff line change 1- name : Documentation
1+ #
2+ # Publish Documentation to GitHub pages.
3+ #
4+ name : Publish Documentation
25
36on :
4- release :
5- types : [ published ]
6-
7- # Allows running this workflow manually from the Actions tab
7+ workflow_call :
88 workflow_dispatch :
99
1010jobs :
11- publish-docs :
12- name : Publish Docs
11+ documentation :
12+ name : Publish Documentation
1313 runs-on : ubuntu-latest
1414
1515 steps :
Original file line number Diff line number Diff line change 1+ name : Publish Guide to readme.com
2+
3+ on :
4+ workflow_call :
5+ workflow_dispatch :
6+
7+ jobs :
8+ sync :
9+ uses : mindee/client-lib-actions/.github/workflows/publish-guide.yml@main
10+ secrets : inherit
Original file line number Diff line number Diff line change 1+ name : Publish Release
2+
3+ on :
4+ release :
5+ types : [ published ]
6+
7+ jobs :
8+ publish_docs :
9+ uses : mindee/mindee-api-nodejs/.github/workflows/_publish-docs.yml@main
10+ secrets : inherit
11+ publish_guide :
12+ uses : mindee/mindee-api-nodejs/.github/workflows/_publish-guide.yml@main
13+ needs : publish_docs
14+ secrets : inherit
15+ publish_code :
16+ uses : mindee/mindee-api-nodejs/.github/workflows/_publish-code.yml@main
17+ secrets : inherit
Original file line number Diff line number Diff line change 1+ name : Push Main Branch
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ tag :
10+ uses : mindee/client-lib-actions/.github/workflows/tag-version.yml@main
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 66jobs :
77 run-tests :
88 name : Run Integration Tests
9- runs-on : ubuntu-latest
9+ timeout-minutes : 30
1010 strategy :
11+ max-parallel : 4
1112 matrix :
13+ os :
14+ - " ubuntu-latest"
15+ - " windows-latest"
16+ - " macos-latest"
1217 node-version :
1318 - " 18"
14- - " 20"
1519 - " 22"
20+ runs-on : ${{ matrix.os }}
1621
1722 steps :
1823 - name : Check out Git repository
Original file line number Diff line number Diff line change 66jobs :
77 run-tests :
88 name : Run Tests
9- runs-on : ubuntu-latest
109 strategy :
10+ max-parallel : 4
1111 matrix :
12+ os :
13+ - " ubuntu-latest"
1214 node-version :
1315 - " 18"
1416 - " 20"
1517 - " 22"
18+ runs-on : ${{ matrix.os }}
1619
1720 steps :
1821 - name : Check out Git repository
Original file line number Diff line number Diff line change @@ -13,10 +13,6 @@ interface MindeeApiConstructorProps {
1313 apiKey : string ;
1414}
1515
16- const USER_AGENT : string = `mindee-api-nodejs@v${ sdkVersion } nodejs-${
17- process . version
18- } ${ os . type ( ) . toLowerCase ( ) } `;
19-
2016export class ApiSettings {
2117 apiKey : string ;
2218 baseHeaders : Record < string , string > ;
@@ -38,13 +34,29 @@ export class ApiSettings {
3834 ) ;
3935 }
4036 this . baseHeaders = {
41- "User-Agent" : USER_AGENT ,
37+ "User-Agent" : this . getUserAgent ( ) ,
4238 Authorization : `Token ${ this . apiKey } ` ,
4339 } ;
4440 this . hostname = this . hostnameFromEnv ( ) ;
4541 this . timeout = process . env . MINDEE_REQUEST_TIMEOUT ? parseInt ( process . env . MINDEE_REQUEST_TIMEOUT ) : TIMEOUT_DEFAULT ;
4642 }
4743
44+ protected getUserAgent ( ) : string {
45+ let platform = os . type ( ) . toLowerCase ( ) ;
46+ if ( platform . includes ( "darwin" ) ) {
47+ platform = "macos" ;
48+ }
49+ else if ( platform . includes ( "window" ) ) {
50+ platform = "windows" ;
51+ }
52+ else if ( platform . includes ( "bsd" ) ) {
53+ platform = "bsd" ;
54+ }
55+ return `mindee-api-nodejs@v${ sdkVersion } nodejs-${
56+ process . version
57+ } ${ platform } `;
58+ }
59+
4860 protected apiKeyFromEnv ( ) : string {
4961 const envVarValue = process . env [ API_KEY_ENVVAR_NAME ] ;
5062 if ( envVarValue ) {
You can’t perform that action at this time.
0 commit comments