Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
290e6a13bf | ||
|
|
ec56d49b16 |
26
README.md
26
README.md
@@ -4,9 +4,15 @@ This action will help you upload an Android `.apk` or `.aab` (Android App Bundle
|
|||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
|
_You must provide one of either `serviceAccountJson` or `serviceAccountJsonPlainText`_
|
||||||
|
|
||||||
### `serviceAccountJson`
|
### `serviceAccountJson`
|
||||||
|
|
||||||
**Required:** The service account json private key file to authorize the upload request
|
The service account json private key file to authorize the upload request
|
||||||
|
|
||||||
|
### `serviceAccountJsonPlainText`
|
||||||
|
|
||||||
|
The service account json in plain text, provided via a secret, etc.
|
||||||
|
|
||||||
### `packageName`
|
### `packageName`
|
||||||
|
|
||||||
@@ -28,11 +34,21 @@ Portion of users who should get the staged version of the app. Accepts values be
|
|||||||
|
|
||||||
### `whatsNewDirectory`
|
### `whatsNewDirectory`
|
||||||
|
|
||||||
The directory of localized whats new files to upload as the release notes. Using the pattern `whatsnew-<LOCALE>`
|
The directory of localized whats new files to upload as the release notes. The files contained in the `whatsNewDirectory` MUST use the pattern `whatsnew-<LOCALE>` where `LOCALE` is using the [`BCP 47`](https://tools.ietf.org/html/bcp47) format, e.g.
|
||||||
i.e. `whatsnew-en-US`. Where `LOCALE` is using the [`BCP 47`](https://tools.ietf.org/html/bcp47) format, for example:
|
|
||||||
* `en-US` - English/America
|
* `en-US` - English/America
|
||||||
* `de-DE` - German/Germany
|
* `de-DE` - German/Germany
|
||||||
* `ja-JP` - Japanese/Japan
|
* `ja-JP` - Japanese/Japan
|
||||||
|
|
||||||
|
and contain plain `utf8` encoded text with no extension on the file. The resulting directory in your project should look something like this:
|
||||||
|
```
|
||||||
|
projectDir/
|
||||||
|
└── whatsNewDirectory/
|
||||||
|
├── whatsnew-en-US
|
||||||
|
├── whatsnew-de-DE
|
||||||
|
└── whatsnew-ja-JP
|
||||||
|
```
|
||||||
|
where `whatsNewDirectory` is the path you pass to the action.
|
||||||
|
|
||||||
|
|
||||||
### `mappingFile`
|
### `mappingFile`
|
||||||
|
|
||||||
@@ -50,4 +66,4 @@ with:
|
|||||||
userFraction: 0.33
|
userFraction: 0.33
|
||||||
whatsNewDirectory: /distribution/whatsnew
|
whatsNewDirectory: /distribution/whatsnew
|
||||||
mappingFile: /app/build/outputs/mapping/release/mapping.txt
|
mappingFile: /app/build/outputs/mapping/release/mapping.txt
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ branding:
|
|||||||
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: true
|
required: false
|
||||||
|
serviceAccountJsonPlainText:
|
||||||
|
description: 'The raw json text of the service account private key to authorize the upload request'
|
||||||
|
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
|
||||||
|
|||||||
23
lib/main.js
23
lib/main.js
@@ -26,13 +26,32 @@ const auth = new google.auth.GoogleAuth({
|
|||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const serviceAccountJson = core.getInput('serviceAccountJson', { required: true });
|
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
|
||||||
|
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false });
|
||||||
const packageName = core.getInput('packageName', { required: true });
|
const packageName = core.getInput('packageName', { required: true });
|
||||||
const releaseFile = core.getInput('releaseFile', { required: true });
|
const releaseFile = core.getInput('releaseFile', { required: true });
|
||||||
const track = core.getInput('track', { required: true });
|
const track = core.getInput('track', { required: true });
|
||||||
const userFraction = core.getInput('userFraction', { required: false });
|
const userFraction = core.getInput('userFraction', { required: false });
|
||||||
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
|
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
|
||||||
const mappingFile = core.getInput('mappingFile', { required: false });
|
const mappingFile = core.getInput('mappingFile', { required: false });
|
||||||
|
if (!serviceAccountJson && !serviceAccountJsonRaw) {
|
||||||
|
console.log("No service account json key provided!");
|
||||||
|
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
|
||||||
|
}
|
||||||
|
// 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
|
||||||
|
if (serviceAccountJsonRaw) {
|
||||||
|
const serviceAccountFile = "./serviceAccountJson.json";
|
||||||
|
fs.writeFileSync(serviceAccountFile, serviceAccountJsonRaw, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
// Insure that the api can find our service account credentials
|
||||||
|
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountFile);
|
||||||
|
}
|
||||||
|
if (serviceAccountJson) {
|
||||||
|
// Insure that the api can find our service account credentials
|
||||||
|
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountJson);
|
||||||
|
}
|
||||||
// verify inputs
|
// verify inputs
|
||||||
let userFractionFloat = parseFloat(userFraction);
|
let userFractionFloat = parseFloat(userFraction);
|
||||||
if (!isNaN(userFractionFloat)) {
|
if (!isNaN(userFractionFloat)) {
|
||||||
@@ -57,8 +76,6 @@ function run() {
|
|||||||
core.setFailed(`Unable to find 'mappingFile' @ ${mappingFile}`);
|
core.setFailed(`Unable to find 'mappingFile' @ ${mappingFile}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Insure that the api can find our service account credentials
|
|
||||||
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountJson);
|
|
||||||
const authClient = yield auth.getClient();
|
const authClient = yield auth.getClient();
|
||||||
yield edits_1.uploadRelease({
|
yield edits_1.uploadRelease({
|
||||||
auth: authClient,
|
auth: authClient,
|
||||||
|
|||||||
28
src/main.ts
28
src/main.ts
@@ -9,7 +9,8 @@ const auth = new google.auth.GoogleAuth({
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const serviceAccountJson = core.getInput('serviceAccountJson', { required: true });
|
const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
|
||||||
|
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false});
|
||||||
const packageName = core.getInput('packageName', { required: true });
|
const packageName = core.getInput('packageName', { required: true });
|
||||||
const releaseFile = core.getInput('releaseFile', { required: true });
|
const releaseFile = core.getInput('releaseFile', { required: true });
|
||||||
const track = core.getInput('track', { required: true });
|
const track = core.getInput('track', { required: true });
|
||||||
@@ -17,6 +18,28 @@ async function run() {
|
|||||||
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
|
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
|
||||||
const mappingFile = core.getInput('mappingFile', { required: false });
|
const mappingFile = core.getInput('mappingFile', { required: false });
|
||||||
|
|
||||||
|
if (!serviceAccountJson && !serviceAccountJsonRaw) {
|
||||||
|
console.log("No service account json key provided!");
|
||||||
|
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
if (serviceAccountJsonRaw) {
|
||||||
|
const serviceAccountFile = "./serviceAccountJson.json";
|
||||||
|
fs.writeFileSync(serviceAccountFile, serviceAccountJsonRaw, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Insure that the api can find our service account credentials
|
||||||
|
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serviceAccountJson) {
|
||||||
|
// Insure that the api can find our service account credentials
|
||||||
|
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountJson);
|
||||||
|
}
|
||||||
|
|
||||||
// verify inputs
|
// verify inputs
|
||||||
let userFractionFloat: number | undefined = parseFloat(userFraction);
|
let userFractionFloat: number | undefined = parseFloat(userFraction);
|
||||||
if (!isNaN(userFractionFloat)) {
|
if (!isNaN(userFractionFloat)) {
|
||||||
@@ -44,9 +67,6 @@ async function run() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insure that the api can find our service account credentials
|
|
||||||
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountJson);
|
|
||||||
|
|
||||||
const authClient = await auth.getClient();
|
const authClient = await auth.getClient();
|
||||||
|
|
||||||
await uploadRelease({
|
await uploadRelease({
|
||||||
|
|||||||
Reference in New Issue
Block a user