diff --git a/README.md b/README.md
index 869fbd1b..17c2ca5d 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,9 @@ The service account json in plain text, provided via a secret, etc.
**Required:** The package name, or Application Id, of the app you are uploading
-### `releaseFile`
+### `releaseFiles`
-**Required:** The Android release file to upload (.apk or .aab)
+**Required:** The Android release file(s) to upload (.apk or .aab). Multiple files are separated by ','.
### `track`
diff --git a/action.yml b/action.yml
index 5f1e171b..0f547851 100644
--- a/action.yml
+++ b/action.yml
@@ -14,8 +14,8 @@ inputs:
packageName:
description: 'The package name, or Application Id, of the app you are uploading'
required: true
- releaseFile:
- description: 'The Android release file to upload (.apk or .aab)'
+ releaseFiles:
+ description: "The Android release file(s) to upload (.apk or .aab). Separated by a ',' for multiple artifacts"
required: true
track:
description: 'The track in which you want to assign the uploaded app.'
diff --git a/lib/edits.js b/lib/edits.js
index 8b1ee7fe..69ee329b 100644
--- a/lib/edits.js
+++ b/lib/edits.js
@@ -1,4 +1,23 @@
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,82 +27,117 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
-};
Object.defineProperty(exports, "__esModule", { value: true });
+exports.uploadToPlayStore = void 0;
const core = __importStar(require("@actions/core"));
const fs = __importStar(require("fs"));
const fs_1 = require("fs");
const googleapis_1 = require("googleapis");
const whatsnew_1 = require("./whatsnew");
const androidPublisher = googleapis_1.google.androidpublisher('v3');
-function uploadRelease(options, releaseFile) {
+function uploadToPlayStore(options, releaseFiles) {
return __awaiter(this, void 0, void 0, function* () {
// Check the 'track' for 'internalsharing', if so switch to a non-track api
if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api");
- if (releaseFile.endsWith('.apk')) {
- const res = yield internalSharingUploadApk(options, releaseFile);
- return Promise.resolve(res.downloadUrl);
+ for (const releaseFile of releaseFiles) {
+ core.debug(`Uploading ${releaseFile}`);
+ yield uploadInternalSharingRelease(options, releaseFile).catch(reason => {
+ core.setFailed(reason);
+ return Promise.reject(reason);
+ });
}
- else if (releaseFile.endsWith('.aab')) {
- const res = yield internalSharingUploadBundle(options, releaseFile);
- return Promise.resolve(res.downloadUrl);
- }
- else {
- return Promise.reject(`Unrecognized Release File`);
- }
- }
- const appEdit = yield androidPublisher.edits.insert({
- auth: options.auth,
- packageName: options.applicationId
- });
- const allTracks = yield getAllTracks(appEdit.data, options);
- if (allTracks == undefined || allTracks.find(value => value.track == options.track) == undefined) {
- core.setFailed(`Track "${options.track}" could not be found `);
- return Promise.reject(`No track found for "${options.track}"`);
- }
- let track = undefined;
- if (releaseFile.endsWith('.apk')) {
- const apk = yield uploadApk(appEdit.data, options, releaseFile);
- yield uploadMappingFile(appEdit.data, apk.versionCode, options);
- track = yield trackVersionCode(appEdit.data, options, apk.versionCode);
- }
- else if (releaseFile.endsWith('.aab')) {
- const bundle = yield uploadBundle(appEdit.data, options, releaseFile);
- yield uploadMappingFile(appEdit.data, bundle.versionCode, options);
- track = yield trackVersionCode(appEdit.data, options, bundle.versionCode);
}
else {
- return Promise.reject("Invalid release file");
- }
- if (track != undefined) {
+ // Create a new Edit
+ const appEdit = yield androidPublisher.edits.insert({
+ auth: options.auth,
+ packageName: options.applicationId
+ });
+ // Validate the given track
+ yield validateSelectedTrack(appEdit.data, options).catch(reason => {
+ core.setFailed(reason);
+ return Promise.reject(reason);
+ });
+ // Upload artifacts to Google Play, and store their version codes
+ var versionCodes = new Array();
+ for (const releaseFile of releaseFiles) {
+ core.debug(`Uploading ${releaseFile}`);
+ const versionCode = yield uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
+ core.setFailed(reason);
+ return Promise.reject(reason);
+ });
+ versionCodes.push(versionCode);
+ }
+ // Add the uploaded artifacts to the Edit track
+ const track = yield addReleasesToTrack(appEdit.data, options, versionCodes);
+ // Commit the pending Edit
const res = yield androidPublisher.edits.commit({
auth: options.auth,
editId: appEdit.data.id,
packageName: options.applicationId
});
- core.debug(`Committed release with Id(${res.data.id}) and Track: ${track}`);
+ // Simple check to see whether commit was successful
+ if (res.data.id != null) {
+ core.debug(`Successfully committed ${res.data.id}`);
+ return Promise.resolve(res.data.id);
+ }
+ else {
+ core.setFailed(`Error ${res.status}: ${res.statusText}`);
+ return Promise.reject(res.status);
+ }
}
});
}
-exports.uploadRelease = uploadRelease;
-function getAllTracks(appEdit, options) {
+exports.uploadToPlayStore = uploadToPlayStore;
+function uploadInternalSharingRelease(options, releaseFile) {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (releaseFile.endsWith('.apk')) {
+ const res = yield internalSharingUploadApk(options, releaseFile);
+ console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`);
+ return Promise.resolve(res.downloadUrl);
+ }
+ else if (releaseFile.endsWith('.aab')) {
+ const res = yield internalSharingUploadBundle(options, releaseFile);
+ console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`);
+ return Promise.resolve(res.downloadUrl);
+ }
+ else {
+ return Promise.reject(`${releaseFile} is invalid`);
+ }
+ });
+}
+function uploadRelease(appEdit, options, releaseFile) {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (releaseFile.endsWith('.apk')) {
+ const apk = yield uploadApk(appEdit, options, releaseFile);
+ yield uploadMappingFile(appEdit, apk.versionCode, options);
+ return Promise.resolve(apk.versionCode);
+ }
+ else if (releaseFile.endsWith('.aab')) {
+ const bundle = yield uploadBundle(appEdit, options, releaseFile);
+ yield uploadMappingFile(appEdit, bundle.versionCode, options);
+ return Promise.resolve(bundle.versionCode);
+ }
+ else {
+ return Promise.reject(`${releaseFile} is invalid`);
+ }
+ });
+}
+function validateSelectedTrack(appEdit, options) {
return __awaiter(this, void 0, void 0, function* () {
const res = yield androidPublisher.edits.tracks.list({
auth: options.auth,
editId: appEdit.id,
packageName: options.applicationId
});
- return res.data.tracks;
+ const allTracks = res.data.tracks;
+ if (allTracks == undefined || allTracks.find(value => value.track == options.track) == undefined) {
+ return Promise.reject(`Track "${options.track}" could not be found `);
+ }
});
}
-function trackVersionCode(appEdit, options, versionCode) {
+function addReleasesToTrack(appEdit, options, versionCodes) {
return __awaiter(this, void 0, void 0, function* () {
let status;
if (options.userFraction != undefined) {
@@ -92,7 +146,7 @@ function trackVersionCode(appEdit, options, versionCode) {
else {
status = 'completed';
}
- core.debug(`Creating Track Release for Edit(${appEdit.id}) for Track(${options.track}) with a UserFraction(${options.userFraction}) and VersionCode(${versionCode})`);
+ core.debug(`Creating Track Release for Edit(${appEdit.id}) for Track(${options.track}) with a UserFraction(${options.userFraction}) and VersionCodes(${versionCodes})`);
const res = yield androidPublisher.edits.tracks
.update({
auth: options.auth,
@@ -106,9 +160,7 @@ function trackVersionCode(appEdit, options, versionCode) {
userFraction: options.userFraction,
status: status,
releaseNotes: yield whatsnew_1.readLocalizedReleaseNotes(options.whatsNewDir),
- versionCodes: [
- versionCode.toString()
- ]
+ versionCodes: versionCodes.filter(x => x != 0).map(x => x.toString())
}
]
}
diff --git a/lib/main.js b/lib/main.js
index 951e9a3b..6c8cd1c7 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -1,4 +1,23 @@
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +27,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
-};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const fs = __importStar(require("fs"));
@@ -29,7 +41,7 @@ function run() {
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false });
const packageName = core.getInput('packageName', { required: true });
- const releaseFile = core.getInput('releaseFile', { required: true });
+ const releaseFiles = core.getInput('releaseFiles', { required: true }).split(',').filter(x => x !== '');
const track = core.getInput('track', { required: true });
const userFraction = core.getInput('userFraction', { required: false });
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
@@ -63,10 +75,13 @@ function run() {
else {
userFractionFloat = undefined;
}
- // Check release file
- if (!fs.existsSync(releaseFile)) {
- core.setFailed(`Unable to find release file @ ${releaseFile}`);
- return;
+ // Check release files
+ for (const releaseFile of releaseFiles) {
+ core.debug(`Validating ${releaseFile} exists`);
+ if (!fs.existsSync(releaseFile)) {
+ core.setFailed(`Unable to find release file @ ${releaseFile}`);
+ return;
+ }
}
if (whatsNewDir != undefined && whatsNewDir.length > 0 && !fs.existsSync(whatsNewDir)) {
core.setFailed(`Unable to find 'whatsnew' directory @ ${whatsNewDir}`);
@@ -77,15 +92,15 @@ function run() {
return;
}
const authClient = yield auth.getClient();
- yield edits_1.uploadRelease({
+ yield edits_1.uploadToPlayStore({
auth: authClient,
applicationId: packageName,
track: track,
userFraction: userFractionFloat,
whatsNewDir: whatsNewDir,
mappingFile: mappingFile
- }, releaseFile);
- console.log(`Finished uploading ${releaseFile} to the Play Store`);
+ }, releaseFiles);
+ console.log(`Finished uploading to the Play Store`);
}
catch (error) {
core.setFailed(error.message);
diff --git a/lib/whatsnew.js b/lib/whatsnew.js
index c51a53ce..5bfc4378 100644
--- a/lib/whatsnew.js
+++ b/lib/whatsnew.js
@@ -1,4 +1,23 @@
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
-};
Object.defineProperty(exports, "__esModule", { value: true });
+exports.readLocalizedReleaseNotes = void 0;
const core = __importStar(require("@actions/core"));
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
diff --git a/node_modules/node-fetch/CHANGELOG.md b/node_modules/node-fetch/CHANGELOG.md
index 188fcd39..543d3d94 100644
--- a/node_modules/node-fetch/CHANGELOG.md
+++ b/node_modules/node-fetch/CHANGELOG.md
@@ -5,6 +5,12 @@ Changelog
# 2.x release
+## v2.6.1
+
+**This is an important security release. It is strongly recommended to update as soon as possible.**
+
+- Fix: honor the `size` option after following a redirect.
+
## v2.6.0
- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information.
diff --git a/node_modules/node-fetch/README.md b/node_modules/node-fetch/README.md
index cb199012..2dde7428 100644
--- a/node_modules/node-fetch/README.md
+++ b/node_modules/node-fetch/README.md
@@ -5,11 +5,14 @@ node-fetch
[![build status][travis-image]][travis-url]
[![coverage status][codecov-image]][codecov-url]
[![install size][install-size-image]][install-size-url]
+[![Discord][discord-image]][discord-url]
A light-weight module that brings `window.fetch` to Node.js
(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567))
+[![Backers][opencollective-image]][opencollective-url]
+
- [Motivation](#motivation)
@@ -48,7 +51,7 @@ A light-weight module that brings `window.fetch` to Node.js
## Motivation
-Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime.
+Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime.
See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side).
@@ -56,9 +59,9 @@ See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorph
- Stay consistent with `window.fetch` API.
- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences.
-- Use native promise, but allow substituting it with [insert your favorite promise library].
-- Use native Node streams for body, on both request and response.
-- Decode content encoding (gzip/deflate) properly, and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically.
+- Use native promise but allow substituting it with [insert your favorite promise library].
+- Use native Node streams for body on both request and response.
+- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically.
- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting.
## Difference from client-side fetch
@@ -72,16 +75,16 @@ See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorph
Current stable release (`2.x`)
```sh
-$ npm install node-fetch --save
+$ npm install node-fetch
```
## Loading and configuring the module
-We suggest you load the module via `require`, pending the stabalizing of es modules in node:
+We suggest you load the module via `require` until the stabilization of ES modules in node:
```js
const fetch = require('node-fetch');
```
-If you are using a Promise library other than native, set it through fetch.Promise:
+If you are using a Promise library other than native, set it through `fetch.Promise`:
```js
const Bluebird = require('bluebird');
@@ -90,7 +93,7 @@ fetch.Promise = Bluebird;
## Common Usage
-NOTE: The documentation below is up-to-date with `2.x` releases, [see `1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences.
+NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences.
#### Plain text or HTML
```js
@@ -146,9 +149,9 @@ fetch('https://httpbin.org/post', { method: 'POST', body: params })
```
#### Handling exceptions
-NOTE: 3xx-5xx responses are *NOT* exceptions, and should be handled in `then()`, see the next section.
+NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information.
-Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, like network errors, and operational errors which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details.
+Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details.
```js
fetch('https://domain.invalid/')
@@ -186,7 +189,7 @@ fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
```
#### Buffer
-If you prefer to cache binary data in full, use buffer(). (NOTE: buffer() is a `node-fetch` only API)
+If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API)
```js
const fileType = require('file-type');
@@ -211,7 +214,7 @@ fetch('https://github.com/')
#### Extract Set-Cookie Header
-Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`, this is a `node-fetch` only API.
+Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API.
```js
fetch(url).then(res => {
@@ -263,11 +266,11 @@ fetch('https://httpbin.org/post', options)
#### Request cancellation with AbortSignal
-> NOTE: You may only cancel streamed requests on Node >= v8.0.0
+> NOTE: You may cancel streamed requests only on Node >= v8.0.0
You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller).
-An example of timing out a request after 150ms could be achieved as follows:
+An example of timing out a request after 150ms could be achieved as the following:
```js
import AbortController from 'abort-controller';
@@ -308,7 +311,7 @@ See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js)
Perform an HTTP(S) fetch.
-`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected promise.
+`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`.
### Options
@@ -350,7 +353,7 @@ Note: when `body` is a `Stream`, `Content-Length` is not set automatically.
##### Custom Agent
-The `agent` option allows you to specify networking related options that's out of the scope of Fetch. Including and not limit to:
+The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following:
- Support self-signed certificate
- Use only IPv4 or IPv6
@@ -358,7 +361,7 @@ The `agent` option allows you to specify networking related options that's out o
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
-In addition, `agent` option accepts a function that returns http(s).Agent instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
+In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
```js
const httpAgent = new http.Agent({
@@ -432,7 +435,7 @@ The following properties are not implemented in node-fetch at this moment:
*(spec-compliant)*
-- `body` A string or [Readable stream][node-readable]
+- `body` A `String` or [`Readable` stream][node-readable]
- `options` A [`ResponseInit`][response-init] options dictionary
Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response).
@@ -462,7 +465,7 @@ This class allows manipulating and iterating over a set of HTTP headers. All met
- `init` Optional argument to pre-fill the `Headers` object
-Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object, or any iterable object.
+Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object.
```js
// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class
@@ -503,7 +506,7 @@ The following methods are not yet implemented in node-fetch at this moment:
* Node.js [`Readable` stream][node-readable]
-The data encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable].
+Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable].
#### body.bodyUsed
@@ -511,7 +514,7 @@ The data encapsulated in the `Body` object. Note that while the [Fetch Standard]
* `Boolean`
-A boolean property for if this body has been consumed. Per spec, a consumed body cannot be used again.
+A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again.
#### body.arrayBuffer()
#### body.blob()
@@ -538,9 +541,9 @@ Consume the body and return a promise that will resolve to a Buffer.
* Returns: Promise<String>
-Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8, if possible.
+Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible.
-(This API requires an optional dependency on npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.)
+(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.)
### Class: FetchError
@@ -574,6 +577,10 @@ MIT
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
+[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square
+[discord-url]: https://discord.gg/Zxbndcm
+[opencollective-image]: https://opencollective.com/node-fetch/backers.svg
+[opencollective-url]: https://opencollective.com/node-fetch
[whatwg-fetch]: https://fetch.spec.whatwg.org/
[response-init]: https://fetch.spec.whatwg.org/#responseinit
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
diff --git a/node_modules/node-fetch/browser.js b/node_modules/node-fetch/browser.js
index 0ad5de00..83c54c58 100644
--- a/node_modules/node-fetch/browser.js
+++ b/node_modules/node-fetch/browser.js
@@ -16,7 +16,9 @@ var global = getGlobal();
module.exports = exports = global.fetch;
// Needed for TypeScript and Webpack.
-exports.default = global.fetch.bind(global);
+if (global.fetch) {
+ exports.default = global.fetch.bind(global);
+}
exports.Headers = global.Headers;
exports.Request = global.Request;
diff --git a/node_modules/node-fetch/lib/index.es.js b/node_modules/node-fetch/lib/index.es.js
index 37d022c9..61906c95 100644
--- a/node_modules/node-fetch/lib/index.es.js
+++ b/node_modules/node-fetch/lib/index.es.js
@@ -461,6 +461,12 @@ function convertBody(buffer, headers) {
// html4
if (!res && str) {
res = / {
+export async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]): Promise {
// Check the 'track' for 'internalsharing', if so switch to a non-track api
- if (options.track === 'internalsharing'){
+ if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api")
- if (releaseFile.endsWith('.apk')) {
- const res = await internalSharingUploadApk(options, releaseFile)
- return Promise.resolve(res.downloadUrl)
- } else if (releaseFile.endsWith('.aab')) {
- const res = await internalSharingUploadBundle(options, releaseFile)
- return Promise.resolve(res.downloadUrl)
- } else {
- return Promise.reject(`Unrecognized Release File`)
+ for (const releaseFile of releaseFiles) {
+ core.debug(`Uploading ${releaseFile}`);
+ await uploadInternalSharingRelease(options, releaseFile).catch(reason => {
+ core.setFailed(reason);
+ return Promise.reject(reason);
+ });
}
- }
-
- const appEdit = await androidPublisher.edits.insert({
- auth: options.auth,
- packageName: options.applicationId
- });
-
- const allTracks = await getAllTracks(appEdit.data!, options);
- if (allTracks == undefined || allTracks.find(value => value.track == options.track) == undefined) {
- core.setFailed(`Track "${options.track}" could not be found `)
- return Promise.reject(`No track found for "${options.track}"`)
- }
-
- let track: Track | undefined = undefined;
- if (releaseFile.endsWith('.apk')) {
- const apk = await uploadApk(appEdit.data, options, releaseFile);
- await uploadMappingFile(appEdit.data, apk.versionCode!, options);
- track = await trackVersionCode(appEdit.data, options, apk.versionCode!)
- } else if (releaseFile.endsWith('.aab')) {
- const bundle = await uploadBundle(appEdit.data, options, releaseFile);
- await uploadMappingFile(appEdit.data, bundle.versionCode!, options);
- track = await trackVersionCode(appEdit.data, options, bundle.versionCode!)
} else {
- return Promise.reject("Invalid release file")
- }
+ // Create a new Edit
+ const appEdit = await androidPublisher.edits.insert({
+ auth: options.auth,
+ packageName: options.applicationId
+ });
- if (track != undefined) {
+ // Validate the given track
+ await validateSelectedTrack(appEdit.data, options).catch(reason => {
+ core.setFailed(reason);
+ return Promise.reject(reason);
+ });
+
+ // Upload artifacts to Google Play, and store their version codes
+ var versionCodes = new Array();
+ for (const releaseFile of releaseFiles) {
+ core.debug(`Uploading ${releaseFile}`);
+ const versionCode = await uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
+ core.setFailed(reason);
+ return Promise.reject(reason);
+ });
+ versionCodes.push(versionCode!);
+ }
+
+ // Add the uploaded artifacts to the Edit track
+ const track = await addReleasesToTrack(appEdit.data, options, versionCodes);
+
+ // Commit the pending Edit
const res = await androidPublisher.edits.commit({
auth: options.auth,
editId: appEdit.data.id!,
packageName: options.applicationId
});
- core.debug(`Committed release with Id(${res.data.id}) and Track: ${track}`);
+ // Simple check to see whether commit was successful
+ if (res.data.id != null) {
+ core.debug(`Successfully committed ${res.data.id}`);
+ return Promise.resolve(res.data.id!);
+ } else {
+ core.setFailed(`Error ${res.status}: ${res.statusText}`);
+ return Promise.reject(res.status);
+ }
}
}
-async function getAllTracks(appEdit: AppEdit, options: EditOptions): Promise