Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request mobile-dev-inc#12 from mobile-dev-inc/MOB-1942
Browse files Browse the repository at this point in the history
feat: allow matching app file by glob
  • Loading branch information
axelniklasson authored Feb 24, 2023
2 parents 2631848 + 4d7e947 commit ec63e52
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 76 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
app-file: app/build/outputs/apk/debug/app-debug.apk
```

`app-file` should point to an x86 compatible APK file
`app-file` should point to an x86 compatible APK file, either directly to the file or a glob pattern matching the file name. When using a pattern, the first matched file will be used.

### Proguard Deobfuscation

Expand All @@ -64,7 +64,7 @@ Include the Proguard mapping file to deobfuscate Android performance traces:
mapping-file: <app_name>.app.dSYM
```

`app-file` should point to an x86 compatible Simulator .app build.
`app-file` should point to an x86 compatible Simulator .app build, either directly to the file or a glob pattern matching the file name. When using a pattern, the first matched file will be used.

### .dSYM file

Expand Down
13 changes: 8 additions & 5 deletions archive_utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { existsSync, lstatSync } from "fs";
import { lstat } from "fs/promises";
import { glob } from "glob";
import path from "path";

const archiver = require("archiver");
Expand Down Expand Up @@ -37,16 +38,18 @@ export async function zipIfFolder(
inputPath: string,
): Promise<string> {
return new Promise(async (resolve, reject) => {
const stat = await lstat(inputPath);
const paths = glob.sync(inputPath);
if (paths.length === 0) throw new Error(`Could not find file matching pattern: ${inputPath}`);
const stat = await lstat(paths[0]);

if (stat.isDirectory()) {
const basename = path.basename(inputPath);
const basename = path.basename(paths[0]);
const archiveName = basename + '.zip';

await zipFolder(inputPath, archiveName, basename);
await zipFolder(paths[0], archiveName, basename);
resolve(archiveName);
} else {
resolve(inputPath);
resolve(paths[0]);
}
});
}
}
200 changes: 131 additions & 69 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"homepage": "https://github.com/mobile-dev-inc/action-maestro-cloud#readme",
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/node": "^17.0.45",
"typescript": "^4.6.3"
},
Expand All @@ -28,6 +29,7 @@
"@vercel/ncc": "^0.33.3",
"archiver": "^5.3.1",
"console-log-colors": "^0.2.3",
"glob": "^8.1.0",
"node-fetch": "^3.2.10",
"node-stream-zip": "^1.15.0"
}
Expand Down

0 comments on commit ec63e52

Please sign in to comment.