Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a899564283 | ||
|
|
373fb32d65 | ||
|
|
3ea191f69b | ||
|
|
09f486f773 | ||
|
|
6bdd0b899a | ||
|
|
e0b7d9bc3e | ||
|
|
e8f8537caf |
@@ -18,9 +18,14 @@ 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
|
**Required:** The package name, or Application Id, of the app you are uploading
|
||||||
|
|
||||||
### `releaseFiles`
|
### `releaseFile`
|
||||||
|
**DEPRECATED:** Please switch to using `releaseFiles` as this will be removed in the future
|
||||||
|
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 ','.
|
### `releaseFiles`
|
||||||
|
**CAVEAT:** Either this or `releaseFile` are required
|
||||||
|
|
||||||
|
The Android release file(s) to upload (.apk or .aab). Multiple files are separated by ','.
|
||||||
|
|
||||||
### `releaseName`
|
### `releaseName`
|
||||||
|
|
||||||
|
|||||||
25
action.yml
25
action.yml
@@ -1,41 +1,44 @@
|
|||||||
name: 'Upload Android Release to Play Store'
|
name: 'Upload Android Release to Play Store'
|
||||||
description: 'An action to upload a signed Android release (.apk or .aab) to the Google Play Store Developer Console'
|
description: "An action to upload a signed Android release (.apk or .aab) to the Google Play Store Developer Console"
|
||||||
author: 'r0adkll'
|
author: 'r0adkll'
|
||||||
branding:
|
branding:
|
||||||
icon: 'truck'
|
icon: 'truck'
|
||||||
color: 'orange'
|
color: 'orange'
|
||||||
inputs:
|
inputs:
|
||||||
serviceAccountJson:
|
serviceAccountJson:
|
||||||
description: 'The service account json private key file to authorize the upload request'
|
description: "The service account json private key file to authorize the upload request"
|
||||||
required: false
|
required: false
|
||||||
serviceAccountJsonPlainText:
|
serviceAccountJsonPlainText:
|
||||||
description: 'The raw json text of the service account private key to authorize the upload request'
|
description: "The raw json text of the service account private key to authorize the upload request"
|
||||||
required: false
|
required: false
|
||||||
packageName:
|
packageName:
|
||||||
description: 'The package name, or Application Id, of the app you are uploading'
|
description: "The package name, or Application Id, of the app you are uploading"
|
||||||
required: true
|
required: true
|
||||||
|
releaseFile:
|
||||||
|
description: "The Android release file to upload (.apk or .aab)"
|
||||||
|
required: false
|
||||||
releaseFiles:
|
releaseFiles:
|
||||||
description: "The Android release file(s) to upload (.apk or .aab). Separated by a ',' for multiple artifacts"
|
description: "The Android release file(s) to upload (.apk or .aab). Separated by a ',' for multiple artifacts"
|
||||||
required: true
|
required: false
|
||||||
releaseName:
|
releaseName:
|
||||||
description: 'The name of this release. If not set it's generated automatically from the APKs versionName'
|
description: "The name of this release. If not set it's generated automatically from the APKs versionName"
|
||||||
required: false
|
required: false
|
||||||
track:
|
track:
|
||||||
description: 'The track in which you want to assign the uploaded app.'
|
description: "The track in which you want to assign the uploaded app."
|
||||||
default: 'production'
|
default: 'production'
|
||||||
required: true
|
required: true
|
||||||
inAppUpdatePriority:
|
inAppUpdatePriority:
|
||||||
description: 'In-app update priority of the release. All newly added APKs in the release will be considered at this priority. Can take values in the range [0, 5], with 5 the highest priority. Defaults to 0.'
|
description: "In-app update priority of the release. All newly added APKs in the release will be considered at this priority. Can take values in the range [0, 5], with 5 the highest priority. Defaults to 0."
|
||||||
default: '0'
|
default: '0'
|
||||||
required: false
|
required: false
|
||||||
userFraction:
|
userFraction:
|
||||||
description: 'Portion of users who should get the staged version of the app. Accepts values between 0.0 and 1.0 (exclusive-exclusive).'
|
description: "Portion of users who should get the staged version of the app. Accepts values between 0.0 and 1.0 (exclusive-exclusive)."
|
||||||
required: false
|
required: false
|
||||||
whatsNewDirectory:
|
whatsNewDirectory:
|
||||||
description: 'The directory of localized whats new files'
|
description: "The directory of localized whats new files"
|
||||||
required: false
|
required: false
|
||||||
mappingFile:
|
mappingFile:
|
||||||
description: 'The mapping.txt file used to de-obfuscate your stack traces from crash reports'
|
description: "The mapping.txt file used to de-obfuscate your stack traces from crash reports"
|
||||||
required: false
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
internalSharingDownloadUrl:
|
internalSharingDownloadUrl:
|
||||||
|
|||||||
13
lib/edits.js
13
lib/edits.js
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -80,6 +80,7 @@ function uploadToPlayStore(options, releaseFiles) {
|
|||||||
// Simple check to see whether commit was successful
|
// Simple check to see whether commit was successful
|
||||||
if (res.data.id != null) {
|
if (res.data.id != null) {
|
||||||
core.debug(`Successfully committed ${res.data.id}`);
|
core.debug(`Successfully committed ${res.data.id}`);
|
||||||
|
core.setOutput("releaseName", getPublishedReleaseName(res.data, options));
|
||||||
return Promise.resolve(res.data.id);
|
return Promise.resolve(res.data.id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -249,3 +250,13 @@ function uploadBundle(appEdit, options, bundleReleaseFile) {
|
|||||||
return res.data;
|
return res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function getPublishedReleaseName(appEdit, options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const track = yield androidPublisher.edits.tracks.get({
|
||||||
|
editId: appEdit.id,
|
||||||
|
track: options.track
|
||||||
|
});
|
||||||
|
const release = track.data.releases[0]; // We only ever create one release, so grab the first one
|
||||||
|
return release.name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
34
lib/main.js
34
lib/main.js
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -36,12 +36,14 @@ const auth = new google.auth.GoogleAuth({
|
|||||||
scopes: ['https://www.googleapis.com/auth/androidpublisher']
|
scopes: ['https://www.googleapis.com/auth/androidpublisher']
|
||||||
});
|
});
|
||||||
function run() {
|
function run() {
|
||||||
|
var _a, _b;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
|
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
|
||||||
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false });
|
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false });
|
||||||
const packageName = core.getInput('packageName', { required: true });
|
const packageName = core.getInput('packageName', { required: true });
|
||||||
const releaseFiles = core.getInput('releaseFiles', { required: true }).split(',').filter(x => x !== '');
|
const releaseFile = core.getInput('releaseFile', { required: false });
|
||||||
|
const releaseFiles = ((_b = (_a = core.getInput('releaseFiles', { required: false })) === null || _a === void 0 ? void 0 : _a.split(',')) === null || _b === void 0 ? void 0 : _b.filter(x => x !== '')) || [];
|
||||||
const releaseName = core.getInput('releaseName', { required: false });
|
const releaseName = core.getInput('releaseName', { required: false });
|
||||||
const track = core.getInput('track', { required: true });
|
const track = core.getInput('track', { required: true });
|
||||||
const inAppUpdatePriority = core.getInput('inAppUpdatePriority', { required: false });
|
const inAppUpdatePriority = core.getInput('inAppUpdatePriority', { required: false });
|
||||||
@@ -52,6 +54,7 @@ function run() {
|
|||||||
if (!serviceAccountJson && !serviceAccountJsonRaw) {
|
if (!serviceAccountJson && !serviceAccountJsonRaw) {
|
||||||
console.log("No service account json key provided!");
|
console.log("No service account json key provided!");
|
||||||
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
|
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// If the user has provided the raw plain text via secrets, or w/e, then write to file and
|
// If the user has provided the raw plain text via secrets, or w/e, then write to file and
|
||||||
// set appropriate env variable for the auth
|
// set appropriate env variable for the auth
|
||||||
@@ -80,7 +83,7 @@ function run() {
|
|||||||
}
|
}
|
||||||
// Validate the inAppUpdatePriority to be a valid number in within [0, 5]
|
// Validate the inAppUpdatePriority to be a valid number in within [0, 5]
|
||||||
let inAppUpdatePriorityInt = parseInt(inAppUpdatePriority);
|
let inAppUpdatePriorityInt = parseInt(inAppUpdatePriority);
|
||||||
if (~isNaN(inAppUpdatePriorityInt)) {
|
if (!isNaN(inAppUpdatePriorityInt)) {
|
||||||
if (inAppUpdatePriorityInt < 0 || inAppUpdatePriorityInt > 5) {
|
if (inAppUpdatePriorityInt < 0 || inAppUpdatePriorityInt > 5) {
|
||||||
core.setFailed('inAppUpdatePriority must be between 0 and 5, inclusive-inclusive');
|
core.setFailed('inAppUpdatePriority must be between 0 and 5, inclusive-inclusive');
|
||||||
return;
|
return;
|
||||||
@@ -89,13 +92,32 @@ function run() {
|
|||||||
else {
|
else {
|
||||||
inAppUpdatePriorityInt = undefined;
|
inAppUpdatePriorityInt = undefined;
|
||||||
}
|
}
|
||||||
// Check release files
|
// Check release files while maintaining backward compatibility
|
||||||
for (const releaseFile of releaseFiles) {
|
let validatedReleaseFiles = [];
|
||||||
|
if (releaseFiles.length == 0 && !releaseFile) {
|
||||||
|
core.setFailed(`You must provide either 'releaseFile' or 'releaseFiles' in your configuration.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (releaseFiles.length == 0 && releaseFile) {
|
||||||
|
core.warning(`WARNING!! 'releaseFile' is deprecated and will be removed in a future release. Please migrate to 'releaseFiles'.`);
|
||||||
core.debug(`Validating ${releaseFile} exists`);
|
core.debug(`Validating ${releaseFile} exists`);
|
||||||
if (!fs.existsSync(releaseFile)) {
|
if (!fs.existsSync(releaseFile)) {
|
||||||
core.setFailed(`Unable to find release file @ ${releaseFile}`);
|
core.setFailed(`Unable to find release file @ ${releaseFile}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
validatedReleaseFiles = [releaseFile];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (releaseFiles.length > 0) {
|
||||||
|
for (const file of releaseFiles) {
|
||||||
|
core.debug(`Validating ${file} exists`);
|
||||||
|
if (!fs.existsSync(file)) {
|
||||||
|
core.setFailed(`Unable to find release file @ ${file}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
validatedReleaseFiles = releaseFiles;
|
||||||
}
|
}
|
||||||
if (whatsNewDir != undefined && whatsNewDir.length > 0 && !fs.existsSync(whatsNewDir)) {
|
if (whatsNewDir != undefined && whatsNewDir.length > 0 && !fs.existsSync(whatsNewDir)) {
|
||||||
core.setFailed(`Unable to find 'whatsnew' directory @ ${whatsNewDir}`);
|
core.setFailed(`Unable to find 'whatsnew' directory @ ${whatsNewDir}`);
|
||||||
@@ -115,7 +137,7 @@ function run() {
|
|||||||
whatsNewDir: whatsNewDir,
|
whatsNewDir: whatsNewDir,
|
||||||
mappingFile: mappingFile,
|
mappingFile: mappingFile,
|
||||||
name: releaseName
|
name: releaseName
|
||||||
}, releaseFiles);
|
}, validatedReleaseFiles);
|
||||||
console.log(`Finished uploading to the Play Store`);
|
console.log(`Finished uploading to the Play Store`);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
10
src/edits.ts
10
src/edits.ts
@@ -77,6 +77,7 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
|||||||
// Simple check to see whether commit was successful
|
// Simple check to see whether commit was successful
|
||||||
if (res.data.id != null) {
|
if (res.data.id != null) {
|
||||||
core.debug(`Successfully committed ${res.data.id}`);
|
core.debug(`Successfully committed ${res.data.id}`);
|
||||||
|
core.setOutput("releaseName", getPublishedReleaseName(res.data, options))
|
||||||
return Promise.resolve(res.data.id!);
|
return Promise.resolve(res.data.id!);
|
||||||
} else {
|
} else {
|
||||||
core.setFailed(`Error ${res.status}: ${res.statusText}`);
|
core.setFailed(`Error ${res.status}: ${res.statusText}`);
|
||||||
@@ -238,3 +239,12 @@ async function uploadBundle(appEdit: AppEdit, options: EditOptions, bundleReleas
|
|||||||
|
|
||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getPublishedReleaseName(appEdit: AppEdit, options: EditOptions): Promise<String | null | undefined> {
|
||||||
|
const track = await androidPublisher.edits.tracks.get({
|
||||||
|
editId: appEdit.id!,
|
||||||
|
track: options.track
|
||||||
|
})
|
||||||
|
const release = track.data.releases![0] // We only ever create one release, so grab the first one
|
||||||
|
return release.name
|
||||||
|
}
|
||||||
32
src/main.ts
32
src/main.ts
@@ -12,7 +12,10 @@ async function run() {
|
|||||||
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
|
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
|
||||||
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false});
|
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false});
|
||||||
const packageName = core.getInput('packageName', { required: true });
|
const packageName = core.getInput('packageName', { required: true });
|
||||||
const releaseFiles = core.getInput('releaseFiles', { required: true }).split(',').filter(x => x !== '');
|
const releaseFile = core.getInput('releaseFile', { required: false });
|
||||||
|
const releaseFiles = core.getInput('releaseFiles', { required: false })
|
||||||
|
?.split(',')
|
||||||
|
?.filter(x => x !== '') || [];
|
||||||
const releaseName = core.getInput('releaseName', { required: false });
|
const releaseName = core.getInput('releaseName', { required: false });
|
||||||
const track = core.getInput('track', { required: true });
|
const track = core.getInput('track', { required: true });
|
||||||
const inAppUpdatePriority = core.getInput('inAppUpdatePriority', { required: false });
|
const inAppUpdatePriority = core.getInput('inAppUpdatePriority', { required: false });
|
||||||
@@ -24,6 +27,7 @@ async function run() {
|
|||||||
if (!serviceAccountJson && !serviceAccountJsonRaw) {
|
if (!serviceAccountJson && !serviceAccountJsonRaw) {
|
||||||
console.log("No service account json key provided!");
|
console.log("No service account json key provided!");
|
||||||
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
|
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user has provided the raw plain text via secrets, or w/e, then write to file and
|
// If the user has provided the raw plain text via secrets, or w/e, then write to file and
|
||||||
@@ -56,7 +60,7 @@ async function run() {
|
|||||||
|
|
||||||
// Validate the inAppUpdatePriority to be a valid number in within [0, 5]
|
// Validate the inAppUpdatePriority to be a valid number in within [0, 5]
|
||||||
let inAppUpdatePriorityInt: number | undefined = parseInt(inAppUpdatePriority);
|
let inAppUpdatePriorityInt: number | undefined = parseInt(inAppUpdatePriority);
|
||||||
if (~isNaN(inAppUpdatePriorityInt)) {
|
if (!isNaN(inAppUpdatePriorityInt)) {
|
||||||
if (inAppUpdatePriorityInt < 0 || inAppUpdatePriorityInt > 5) {
|
if (inAppUpdatePriorityInt < 0 || inAppUpdatePriorityInt > 5) {
|
||||||
core.setFailed('inAppUpdatePriority must be between 0 and 5, inclusive-inclusive');
|
core.setFailed('inAppUpdatePriority must be between 0 and 5, inclusive-inclusive');
|
||||||
return;
|
return;
|
||||||
@@ -65,13 +69,29 @@ async function run() {
|
|||||||
inAppUpdatePriorityInt = undefined;
|
inAppUpdatePriorityInt = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check release files
|
// Check release files while maintaining backward compatibility
|
||||||
for (const releaseFile of releaseFiles) {
|
let validatedReleaseFiles: string[] = [];
|
||||||
|
if (releaseFiles.length == 0 && !releaseFile) {
|
||||||
|
core.setFailed(`You must provide either 'releaseFile' or 'releaseFiles' in your configuration.`);
|
||||||
|
return;
|
||||||
|
} else if (releaseFiles.length == 0 && releaseFile) {
|
||||||
|
core.warning(`WARNING!! 'releaseFile' is deprecated and will be removed in a future release. Please migrate to 'releaseFiles'.`);
|
||||||
core.debug(`Validating ${releaseFile} exists`)
|
core.debug(`Validating ${releaseFile} exists`)
|
||||||
if (!fs.existsSync(releaseFile)) {
|
if (!fs.existsSync(releaseFile)) {
|
||||||
core.setFailed(`Unable to find release file @ ${releaseFile}`);
|
core.setFailed(`Unable to find release file @ ${releaseFile}`);
|
||||||
return
|
return;
|
||||||
|
} else {
|
||||||
|
validatedReleaseFiles = [releaseFile];
|
||||||
}
|
}
|
||||||
|
} else if (releaseFiles.length > 0) {
|
||||||
|
for (const file of releaseFiles) {
|
||||||
|
core.debug(`Validating ${file} exists`)
|
||||||
|
if (!fs.existsSync(file)) {
|
||||||
|
core.setFailed(`Unable to find release file @ ${file}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
validatedReleaseFiles = releaseFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whatsNewDir != undefined && whatsNewDir.length > 0 && !fs.existsSync(whatsNewDir)) {
|
if (whatsNewDir != undefined && whatsNewDir.length > 0 && !fs.existsSync(whatsNewDir)) {
|
||||||
@@ -95,7 +115,7 @@ async function run() {
|
|||||||
whatsNewDir: whatsNewDir,
|
whatsNewDir: whatsNewDir,
|
||||||
mappingFile: mappingFile,
|
mappingFile: mappingFile,
|
||||||
name: releaseName
|
name: releaseName
|
||||||
}, releaseFiles);
|
}, validatedReleaseFiles);
|
||||||
|
|
||||||
console.log(`Finished uploading to the Play Store`)
|
console.log(`Finished uploading to the Play Store`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user