Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c2ebfdb6e | ||
|
|
060a2efa0e |
@@ -48,6 +48,14 @@ _Values:_ `[0, 5]`
|
||||
|
||||
Portion of users who should get the staged version of the app. Accepts values between 0.0 and 1.0 (exclusive-exclusive). Omitting this value will execute a full rollout.
|
||||
|
||||
### `status`
|
||||
|
||||
Release status. This can be set to `draft` to complete the release at some other time.
|
||||
|
||||
**Default:** `inProgress` if `userFraction` is specified, otherwise `completed`
|
||||
|
||||
_Values:_ `completed`, `inProgress`, `draft`, `halted`
|
||||
|
||||
### `whatsNewDirectory`
|
||||
|
||||
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.
|
||||
|
||||
1
__tests__/whatsnew-ca
Normal file
1
__tests__/whatsnew-ca
Normal file
@@ -0,0 +1 @@
|
||||
test_changelog_file_catalan
|
||||
1
__tests__/whatsnew-es-ES
Normal file
1
__tests__/whatsnew-es-ES
Normal file
@@ -0,0 +1 @@
|
||||
test_changelog_file_spanish
|
||||
1
__tests__/whatsnew-et
Normal file
1
__tests__/whatsnew-et
Normal file
@@ -0,0 +1 @@
|
||||
test_changelog_file_estonian
|
||||
@@ -7,7 +7,7 @@ import LocalizedText = androidpublisher_v3.Schema$LocalizedText;
|
||||
|
||||
test("read localized whatsnew files", async () => {
|
||||
let texts = await readLocalizedReleaseNotes("./__tests__");
|
||||
expect(texts).toHaveLength(3);
|
||||
expect(texts).toHaveLength(6);
|
||||
expect(texts).toContainEqual({
|
||||
language: "en-US",
|
||||
text: "test_changelog_file"
|
||||
@@ -20,4 +20,16 @@ test("read localized whatsnew files", async () => {
|
||||
language: "ja-JP",
|
||||
text: "test_changelog_file_japanese"
|
||||
});
|
||||
expect(texts).toContainEqual({
|
||||
language: "ca",
|
||||
text: "test_changelog_file_catalan"
|
||||
});
|
||||
expect(texts).toContainEqual({
|
||||
language: "es-ES",
|
||||
text: "test_changelog_file_spanish"
|
||||
});
|
||||
expect(texts).toContainEqual({
|
||||
language: "et",
|
||||
text: "test_changelog_file_estonian"
|
||||
});
|
||||
});
|
||||
@@ -34,6 +34,9 @@ inputs:
|
||||
userFraction:
|
||||
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
|
||||
status:
|
||||
description: "Release status. This can be set to 'draft' to complete the release at some other time."
|
||||
required: false
|
||||
whatsNewDirectory:
|
||||
description: "The directory of localized whats new files"
|
||||
required: false
|
||||
|
||||
File diff suppressed because one or more lines are too long
17
src/edits.ts
17
src/edits.ts
@@ -27,6 +27,7 @@ export interface EditOptions {
|
||||
whatsNewDir?: string;
|
||||
mappingFile?: string;
|
||||
name?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]): Promise<string | undefined> {
|
||||
@@ -143,14 +144,16 @@ async function validateSelectedTrack(appEdit: AppEdit, options: EditOptions): Pr
|
||||
}
|
||||
|
||||
async function addReleasesToTrack(appEdit: AppEdit, options: EditOptions, versionCodes: number[]): Promise<Track> {
|
||||
let status: string;
|
||||
if (options.userFraction != undefined) {
|
||||
status = 'inProgress';
|
||||
} else {
|
||||
status = 'completed';
|
||||
let status: string | undefined = options.status;
|
||||
if (status == undefined) {
|
||||
if (options.userFraction != undefined) {
|
||||
status = 'inProgress';
|
||||
} else {
|
||||
status = 'completed';
|
||||
}
|
||||
}
|
||||
|
||||
core.debug(`Creating Track Release for Edit(${appEdit.id}) for Track(${options.track}) with a UserFraction(${options.userFraction}) and VersionCodes(${versionCodes})`);
|
||||
core.debug(`Creating Track Release for Edit(${appEdit.id}) for Track(${options.track}) with a UserFraction(${options.userFraction}), Status(${status}), and VersionCodes(${versionCodes})`);
|
||||
const res = await androidPublisher.edits.tracks
|
||||
.update({
|
||||
auth: options.auth,
|
||||
@@ -254,4 +257,4 @@ async function uploadBundle(appEdit: AppEdit, options: EditOptions, bundleReleas
|
||||
});
|
||||
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ async function run() {
|
||||
const track = core.getInput('track', { required: true });
|
||||
const inAppUpdatePriority = core.getInput('inAppUpdatePriority', { required: false });
|
||||
const userFraction = core.getInput('userFraction', { required: false });
|
||||
const status = core.getInput('status', { required: false });
|
||||
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
|
||||
const mappingFile = core.getInput('mappingFile', { required: false });
|
||||
|
||||
@@ -112,6 +113,7 @@ async function run() {
|
||||
track: track,
|
||||
inAppUpdatePriority: inAppUpdatePriorityInt || 0,
|
||||
userFraction: userFractionFloat,
|
||||
status: status,
|
||||
whatsNewDir: whatsNewDir,
|
||||
mappingFile: mappingFile,
|
||||
name: releaseName
|
||||
|
||||
@@ -6,10 +6,11 @@ import {androidpublisher_v3} from "googleapis";
|
||||
import LocalizedText = androidpublisher_v3.Schema$LocalizedText;
|
||||
|
||||
export async function readLocalizedReleaseNotes(whatsNewDir: string | undefined): Promise<LocalizedText[] | undefined> {
|
||||
core.debug(`Executing readLocalizedReleaseNotes`);
|
||||
if (whatsNewDir != undefined && whatsNewDir.length > 0) {
|
||||
const releaseNotes = fs.readdirSync(whatsNewDir)
|
||||
.filter(value => /whatsnew-.*-.{2,3}\b/.test(value));
|
||||
const pattern = /whatsnew-(?<local>.*-.*)/;
|
||||
.filter(value => /whatsnew-((.*-.*)|(.*))\b/.test(value));
|
||||
const pattern = /whatsnew-(?<local>(.*-.*)|(.*))/;
|
||||
|
||||
let localizedReleaseNotes: LocalizedText[] = [];
|
||||
|
||||
@@ -17,7 +18,7 @@ export async function readLocalizedReleaseNotes(whatsNewDir: string | undefined)
|
||||
releaseNotes.forEach(value => {
|
||||
const matches = value.match(pattern);
|
||||
core.debug(`Matches for ${value} = ${matches}`);
|
||||
if (matches != undefined && matches.length == 2) {
|
||||
if (matches != undefined && matches.length == 4) {
|
||||
const lang = matches[1];
|
||||
const filePath = path.join(whatsNewDir, value);
|
||||
const content = readFileSync(filePath, 'utf-8');
|
||||
|
||||
Reference in New Issue
Block a user