bitrise-api-cli 0.0.12 β 0.1.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.
- package/README.md +37 -35
- package/dist/cli.js +35 -21
- package/package.json +50 -15
package/README.md
CHANGED
|
@@ -1,34 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bitrise-api-cli [![npm][npm-image]][npm-url] ![npm][npm-dl-stats]
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Download the latest Bitrise build artifact for a workflow without clicking through the UI.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`bitrise-api-cli` is an unofficial Bitrise CLI focused on one job: find the latest successful build for a workflow, pick the matching artifact, and download it locally.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Workflow-based retrieval
|
|
9
|
-
- CI/CD integration
|
|
7
|
+
## Quick Start
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npx bitrise-api-cli@latest download \
|
|
11
|
+
--token <BITRISE_TOKEN> \
|
|
12
|
+
--workflow <WORKFLOW_NAME> \
|
|
13
|
+
--slug <APP_SLUG>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## What It Can Download
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
- `android-apk` artifacts (default)
|
|
19
|
+
- `ios-ipa` artifacts
|
|
20
|
+
|
|
21
|
+
For Android artifacts you can also install the downloaded file immediately:
|
|
14
22
|
|
|
15
23
|
```bash
|
|
16
|
-
npx bitrise-api-cli@latest download
|
|
24
|
+
npx bitrise-api-cli@latest download \
|
|
25
|
+
--artifact android-apk \
|
|
26
|
+
--install \
|
|
27
|
+
--token <BITRISE_TOKEN> \
|
|
28
|
+
--workflow android-release \
|
|
29
|
+
--slug <APP_SLUG>
|
|
17
30
|
```
|
|
18
31
|
|
|
19
|
-
##
|
|
32
|
+
## Configuration
|
|
20
33
|
|
|
21
|
-
You can combine command
|
|
34
|
+
You can combine command flags, environment variables, and `.bitrise.json`.
|
|
22
35
|
|
|
23
36
|
### Environment Variables
|
|
24
37
|
|
|
25
38
|
- `BITRISE_API_CLI_TOKEN`
|
|
26
39
|
- `BITRISE_API_CLI_WORKFLOW`
|
|
27
|
-
- `BITRISE_APP_SLUG`
|
|
40
|
+
- `BITRISE_APP_SLUG`
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
`BITRISE_APP_SLUG` is usually available automatically in Bitrise CI.
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
### `.bitrise.json`
|
|
32
45
|
|
|
33
46
|
```json
|
|
34
47
|
{
|
|
@@ -38,38 +51,27 @@ The `.bitrise.json` file can be placed in your project root or home directory.
|
|
|
38
51
|
}
|
|
39
52
|
```
|
|
40
53
|
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
### Command Line
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npx bitrise-api-cli@latest download --token abc123 --workflow android-release --slug a1b2c3d4e5f6
|
|
47
|
-
```
|
|
54
|
+
## Main Flags
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
- `--token <token>`: Bitrise API token
|
|
57
|
+
- `--workflow <name>`: workflow whose latest successful build should be used
|
|
58
|
+
- `--slug <app-slug>`: Bitrise app slug
|
|
59
|
+
- `--artifact <android-apk|ios-ipa>`: artifact type to download
|
|
60
|
+
- `--install`: install the downloaded Android artifact locally
|
|
61
|
+
- `--debug`: print extra request and resolution details
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
## CI Example
|
|
52
64
|
|
|
53
65
|
```yaml
|
|
54
66
|
steps:
|
|
55
67
|
- script:
|
|
56
68
|
inputs:
|
|
57
69
|
content: |
|
|
58
|
-
npx bitrise-api-cli download \
|
|
70
|
+
npx bitrise-api-cli@latest download \
|
|
59
71
|
--workflow android-release \
|
|
60
|
-
--token $
|
|
72
|
+
--token "$BITRISE_API_CLI_TOKEN"
|
|
61
73
|
```
|
|
62
74
|
|
|
63
|
-
## π License
|
|
64
|
-
|
|
65
|
-
This project is [MIT](LICENSE) licensed.
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
<div align="center">
|
|
70
|
-
<p>Found this project useful? Give it a βοΈ!</p>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
75
|
[npm-image]: https://img.shields.io/npm/v/bitrise-api-cli
|
|
74
76
|
[npm-url]: https://www.npmjs.com/package/bitrise-api-cli
|
|
75
77
|
[npm-dl-stats]: https://img.shields.io/npm/dm/bitrise-api-cli
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __esm = (fn, res) => function __init() {
|
|
5
|
-
|
|
4
|
+
var __esm = (fn, res, err) => function __init() {
|
|
5
|
+
if (err) throw err[0];
|
|
6
|
+
try {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
throw err = [e], e;
|
|
10
|
+
}
|
|
6
11
|
};
|
|
7
12
|
var __export = (target, all) => {
|
|
8
13
|
for (var name2 in all)
|
|
@@ -119,7 +124,7 @@ var init_oraHelper = __esm({
|
|
|
119
124
|
failText: (error) => {
|
|
120
125
|
if (isFetchError(error))
|
|
121
126
|
return `${label} failed with HTTP Error ${error.response.status} ${error.response.statusText}`;
|
|
122
|
-
return `${label} failed with error: ${error.message}`;
|
|
127
|
+
return `${label} failed with error: ${error instanceof Error ? error.message : String(error)}`;
|
|
123
128
|
},
|
|
124
129
|
successText: (data) => {
|
|
125
130
|
if (data && typeof data === "object" && "duration" in data && typeof data.duration === "number") {
|
|
@@ -132,9 +137,9 @@ var init_oraHelper = __esm({
|
|
|
132
137
|
});
|
|
133
138
|
|
|
134
139
|
// src/helper/tempDir.ts
|
|
135
|
-
import fs from "
|
|
136
|
-
import { tmpdir } from "
|
|
137
|
-
import path from "
|
|
140
|
+
import fs from "fs/promises";
|
|
141
|
+
import { tmpdir } from "os";
|
|
142
|
+
import path from "path";
|
|
138
143
|
var createTempDir;
|
|
139
144
|
var init_tempDir = __esm({
|
|
140
145
|
"src/helper/tempDir.ts"() {
|
|
@@ -163,8 +168,8 @@ var init_tryCatch = __esm({
|
|
|
163
168
|
});
|
|
164
169
|
|
|
165
170
|
// src/device/install/bundletool.ts
|
|
166
|
-
import fs2 from "
|
|
167
|
-
import path2 from "
|
|
171
|
+
import fs2 from "fs/promises";
|
|
172
|
+
import path2 from "path";
|
|
168
173
|
import { oraPromise } from "ora";
|
|
169
174
|
import { $ as $2, which } from "zx";
|
|
170
175
|
var getOrInstallBundletool, bundletoolVersion, bundletoolData, getBundletoolTmpJarPath, $$, getBundleToolJar, installBundleTool;
|
|
@@ -208,8 +213,8 @@ var init_bundletool = __esm({
|
|
|
208
213
|
});
|
|
209
214
|
|
|
210
215
|
// src/device/install/convertAabToApk.ts
|
|
211
|
-
import fs3 from "
|
|
212
|
-
import path3 from "
|
|
216
|
+
import fs3 from "fs/promises";
|
|
217
|
+
import path3 from "path";
|
|
213
218
|
import { $ as $3 } from "zx";
|
|
214
219
|
var convertAabToApk;
|
|
215
220
|
var init_convertAabToApk = __esm({
|
|
@@ -298,6 +303,7 @@ var init_runtime = __esm({
|
|
|
298
303
|
constructor(configuration = {}) {
|
|
299
304
|
this.configuration = configuration;
|
|
300
305
|
}
|
|
306
|
+
configuration;
|
|
301
307
|
set config(configuration) {
|
|
302
308
|
this.configuration = configuration;
|
|
303
309
|
}
|
|
@@ -346,6 +352,7 @@ var init_runtime = __esm({
|
|
|
346
352
|
this.configuration = configuration;
|
|
347
353
|
this.middleware = configuration.middleware;
|
|
348
354
|
}
|
|
355
|
+
configuration;
|
|
349
356
|
static jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i");
|
|
350
357
|
middleware;
|
|
351
358
|
withMiddleware(...middlewares) {
|
|
@@ -481,6 +488,7 @@ var init_runtime = __esm({
|
|
|
481
488
|
super(msg);
|
|
482
489
|
this.response = response;
|
|
483
490
|
}
|
|
491
|
+
response;
|
|
484
492
|
name = "ResponseError";
|
|
485
493
|
};
|
|
486
494
|
FetchError = class extends Error {
|
|
@@ -488,6 +496,7 @@ var init_runtime = __esm({
|
|
|
488
496
|
super(msg);
|
|
489
497
|
this.cause = cause;
|
|
490
498
|
}
|
|
499
|
+
cause;
|
|
491
500
|
name = "FetchError";
|
|
492
501
|
};
|
|
493
502
|
RequiredError = class extends Error {
|
|
@@ -495,6 +504,7 @@ var init_runtime = __esm({
|
|
|
495
504
|
super(msg);
|
|
496
505
|
this.field = field;
|
|
497
506
|
}
|
|
507
|
+
field;
|
|
498
508
|
name = "RequiredError";
|
|
499
509
|
};
|
|
500
510
|
JSONApiResponse = class {
|
|
@@ -502,6 +512,8 @@ var init_runtime = __esm({
|
|
|
502
512
|
this.raw = raw;
|
|
503
513
|
this.transformer = transformer;
|
|
504
514
|
}
|
|
515
|
+
raw;
|
|
516
|
+
transformer;
|
|
505
517
|
async value() {
|
|
506
518
|
return this.transformer(await this.raw.json());
|
|
507
519
|
}
|
|
@@ -510,6 +522,7 @@ var init_runtime = __esm({
|
|
|
510
522
|
constructor(raw) {
|
|
511
523
|
this.raw = raw;
|
|
512
524
|
}
|
|
525
|
+
raw;
|
|
513
526
|
async value() {
|
|
514
527
|
return void 0;
|
|
515
528
|
}
|
|
@@ -518,6 +531,7 @@ var init_runtime = __esm({
|
|
|
518
531
|
constructor(raw) {
|
|
519
532
|
this.raw = raw;
|
|
520
533
|
}
|
|
534
|
+
raw;
|
|
521
535
|
async value() {
|
|
522
536
|
return await this.raw.text();
|
|
523
537
|
}
|
|
@@ -3531,10 +3545,10 @@ var init_fetchBuilds = __esm({
|
|
|
3531
3545
|
});
|
|
3532
3546
|
|
|
3533
3547
|
// src/helper/downloadFile.ts
|
|
3534
|
-
import { createWriteStream } from "
|
|
3535
|
-
import { get } from "
|
|
3536
|
-
import { pipeline } from "
|
|
3537
|
-
import { URL } from "
|
|
3548
|
+
import { createWriteStream } from "fs";
|
|
3549
|
+
import { get } from "https";
|
|
3550
|
+
import { pipeline } from "stream/promises";
|
|
3551
|
+
import { URL } from "url";
|
|
3538
3552
|
var downloadFile;
|
|
3539
3553
|
var init_downloadFile = __esm({
|
|
3540
3554
|
"src/helper/downloadFile.ts"() {
|
|
@@ -3587,7 +3601,7 @@ var init_downloadLatestArtifacts = __esm({
|
|
|
3587
3601
|
init_downloadFile();
|
|
3588
3602
|
init_formatBytes();
|
|
3589
3603
|
init_oraHelper();
|
|
3590
|
-
downloadLatestArtifacts = async (
|
|
3604
|
+
downloadLatestArtifacts = async (_options) => {
|
|
3591
3605
|
const latestBuild = await oraPromise3(getLatestBuild(), getOraTexts("fetching latest build"));
|
|
3592
3606
|
const artifactMetadata = await oraPromise3(
|
|
3593
3607
|
fetchArtifactByType(latestBuild.slug),
|
|
@@ -3631,8 +3645,12 @@ var init_impl = __esm({
|
|
|
3631
3645
|
// src/cli/bin/cli.ts
|
|
3632
3646
|
import { run } from "@stricli/core";
|
|
3633
3647
|
|
|
3648
|
+
// src/cli/app.ts
|
|
3649
|
+
import { buildApplication, buildRouteMap } from "@stricli/core";
|
|
3650
|
+
|
|
3634
3651
|
// src/cli/commands/download/command.ts
|
|
3635
3652
|
init_cliOptions_types();
|
|
3653
|
+
import { buildCommand } from "@stricli/core";
|
|
3636
3654
|
|
|
3637
3655
|
// src/config/readConfig.ts
|
|
3638
3656
|
import { cosmiconfigSync } from "cosmiconfig";
|
|
@@ -3649,7 +3667,6 @@ var readConfig = () => {
|
|
|
3649
3667
|
};
|
|
3650
3668
|
|
|
3651
3669
|
// src/cli/commands/download/command.ts
|
|
3652
|
-
import { buildCommand } from "@stricli/core";
|
|
3653
3670
|
var downloadCommand = buildCommand({
|
|
3654
3671
|
loader: async () => Promise.resolve().then(() => (init_impl(), impl_exports)),
|
|
3655
3672
|
parameters: {
|
|
@@ -3706,13 +3723,10 @@ var downloadCommand = buildCommand({
|
|
|
3706
3723
|
}
|
|
3707
3724
|
});
|
|
3708
3725
|
|
|
3709
|
-
// src/cli/app.ts
|
|
3710
|
-
import { buildApplication, buildRouteMap } from "@stricli/core";
|
|
3711
|
-
|
|
3712
3726
|
// package.json
|
|
3713
3727
|
var name = "bitrise-api-cli";
|
|
3714
|
-
var version = "0.0
|
|
3715
|
-
var description = "
|
|
3728
|
+
var version = "0.1.0";
|
|
3729
|
+
var description = "Download the latest Bitrise build artifacts for a workflow from the command line.";
|
|
3716
3730
|
|
|
3717
3731
|
// src/cli/app.ts
|
|
3718
3732
|
var root = buildRouteMap({
|
package/package.json
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitrise-api-cli",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Download the latest Bitrise build artifacts for a workflow from the command line.",
|
|
5
5
|
"module": "index",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"bitrise-api-cli": "
|
|
8
|
+
"bitrise-api-cli": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"bitrise",
|
|
12
|
+
"bitriseio",
|
|
13
|
+
"ci",
|
|
14
|
+
"artifacts",
|
|
15
|
+
"apk",
|
|
16
|
+
"ipa",
|
|
17
|
+
"download",
|
|
18
|
+
"cli"
|
|
19
|
+
],
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "WookieFPV (Lukas MΓΌller)",
|
|
22
|
+
"url": "https://github.com/WookieFPV"
|
|
9
23
|
},
|
|
10
|
-
"keywords": ["bitrise", "bitriseio", "apk", "downloader"],
|
|
11
24
|
"license": "MIT",
|
|
12
25
|
"main": "dist/cli.js",
|
|
13
|
-
"
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/WookieFPV/bitrise-api-cli.git"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/WookieFPV/bitrise-api-cli#readme",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/WookieFPV/bitrise-api-cli/issues"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
14
37
|
"scripts": {
|
|
15
38
|
"build": "tsup",
|
|
16
39
|
"build:dev": "tsup --watch --clean false",
|
|
@@ -22,18 +45,30 @@
|
|
|
22
45
|
"prepublishOnly": "bun i && bun run lint:CI && tsc && bun run build"
|
|
23
46
|
},
|
|
24
47
|
"dependencies": {
|
|
25
|
-
"@stricli/core": "1.
|
|
26
|
-
"cosmiconfig": "9.0.
|
|
27
|
-
"ora": "
|
|
28
|
-
"zx": "8.5
|
|
48
|
+
"@stricli/core": "1.3.0",
|
|
49
|
+
"cosmiconfig": "9.0.2",
|
|
50
|
+
"ora": "9.4.1",
|
|
51
|
+
"zx": "8.8.5"
|
|
29
52
|
},
|
|
30
53
|
"devDependencies": {
|
|
31
|
-
"@biomejs/biome": "
|
|
32
|
-
"@openapitools/openapi-generator-cli": "2.
|
|
54
|
+
"@biomejs/biome": "2.5.5",
|
|
55
|
+
"@openapitools/openapi-generator-cli": "2.40.0",
|
|
33
56
|
"@total-typescript/ts-reset": "0.6.1",
|
|
34
|
-
"@types/bun": "
|
|
35
|
-
"lefthook": "1.
|
|
36
|
-
"tsup": "8.
|
|
37
|
-
"typescript": "
|
|
57
|
+
"@types/bun": "1.3.14",
|
|
58
|
+
"lefthook": "2.1.10",
|
|
59
|
+
"tsup": "8.5.1",
|
|
60
|
+
"typescript": "7.0.2"
|
|
61
|
+
},
|
|
62
|
+
"overrides": {
|
|
63
|
+
"brace-expansion": "2.1.2",
|
|
64
|
+
"esbuild": "0.28.1",
|
|
65
|
+
"form-data": "4.0.6",
|
|
66
|
+
"glob": "10.5.0",
|
|
67
|
+
"ip-address": "10.2.0",
|
|
68
|
+
"js-yaml": "4.3.0",
|
|
69
|
+
"minimatch": "9.0.9",
|
|
70
|
+
"picomatch": "4.0.4",
|
|
71
|
+
"rollup": "4.60.4",
|
|
72
|
+
"shell-quote": "1.9.0"
|
|
38
73
|
}
|
|
39
74
|
}
|