Fixed precondition checks for whatsnew and mapping files, to fix issues outlined in #2
This commit is contained in:
@@ -106,7 +106,7 @@ async function trackVersionCode(appEdit: AppEdit, options: EditOptions, versionC
|
||||
}
|
||||
|
||||
async function readLocalizedReleaseNotes(whatsNewDir: string | undefined): Promise<LocalizedText[] | undefined> {
|
||||
if (whatsNewDir != undefined) {
|
||||
if (whatsNewDir != undefined && whatsNewDir.length > 0) {
|
||||
const releaseNotes = fs.readdirSync(whatsNewDir).filter(value => /whatsnew-*-*/.test(value));
|
||||
const pattern = /whatsnew-(?<local>.*-.*)/.compile();
|
||||
|
||||
@@ -136,7 +136,7 @@ async function readLocalizedReleaseNotes(whatsNewDir: string | undefined): Promi
|
||||
}
|
||||
|
||||
async function uploadMappingFile(appEdit: AppEdit, versionCode: number, options: EditOptions) {
|
||||
if (options.mappingFile != undefined) {
|
||||
if (options.mappingFile != undefined && options.mappingFile.length > 0) {
|
||||
const mapping = readFileSync(options.mappingFile, 'utf-8');
|
||||
if (mapping != undefined) {
|
||||
core.debug(`[${appEdit.id}, versionCode=${versionCode}, packageName=${options.applicationId}]: Uploading Proguard mapping file @ ${options.mappingFile}`);
|
||||
|
||||
@@ -34,12 +34,12 @@ async function run() {
|
||||
return
|
||||
}
|
||||
|
||||
if (whatsNewDir != undefined && !fs.existsSync(whatsNewDir)) {
|
||||
if (whatsNewDir != undefined && whatsNewDir.length > 0 && !fs.existsSync(whatsNewDir)) {
|
||||
core.setFailed(`Unable to find 'whatsnew' directory @ ${whatsNewDir}`);
|
||||
return
|
||||
}
|
||||
|
||||
if (mappingFile != undefined && !fs.existsSync(mappingFile)) {
|
||||
if (mappingFile != undefined && mappingFile.length > 0 && !fs.existsSync(mappingFile)) {
|
||||
core.setFailed(`Unable to find 'mappingFile' @ ${mappingFile}`);
|
||||
return
|
||||
}
|
||||
@@ -58,7 +58,7 @@ async function run() {
|
||||
mappingFile: mappingFile
|
||||
}, releaseFile);
|
||||
|
||||
core.debug('Finished App Release!')
|
||||
console.log(`Finished uploading ${releaseFile} to the Play Store`)
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user