Skip to content

Commit f237eba

Browse files
committed
Use regex to match artifact names
1 parent 790e61f commit f237eba

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

package-lock.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,7 @@
16761676
"@types/chai": "^4.3.19",
16771677
"@types/chai-as-promised": "^7.1.8",
16781678
"@types/chai-subset": "^1.3.6",
1679+
"@types/decompress": "^4.2.7",
16791680
"@types/glob": "^7.1.6",
16801681
"@types/lcov-parse": "^1.0.2",
16811682
"@types/lodash.debounce": "^4.0.9",

scripts/download_vsix.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,21 @@ const repo = repository.split("/")[1];
5757
const files = await decompress("artifacts.zip", process.cwd());
5858
console.log(`Downloaded artifact(s): ${files.map(f => f.path).join(", ")}`);
5959
const newName = process.env["VSCODE_SWIFT_VSIX"] || "vscode-swift.vsix";
60-
await rename(files[0].path, newName);
61-
console.log(`Renamed artifact: ${files[0].path} => ${newName}`);
60+
const releaseVSIX = files.find(f => /swift-vscode-\d.\d.\d-\d+.vsix/m.test(f.path));
61+
if (!releaseVSIX) {
62+
console.error("Cound not find vscode-swift release VSIX in artifact bundle");
63+
process.exit(1);
64+
}
65+
await rename(releaseVSIX.path, newName);
66+
const prereleaseVSIX = files.find(f => /swift-vscode-\d.\d.\d{8}-\d+.vsix/m.test(f.path));
67+
if (!prereleaseVSIX) {
68+
console.error("Cound not find vscode-swift pre-release VSIX in artifact bundle");
69+
process.exit(1);
70+
}
71+
console.log(`Renamed artifact: ${releaseVSIX.path} => ${newName}`);
6272
const preNewName =
6373
process.env["VSCODE_SWIFT_PRERELEASE_VSIX"] || "vscode-swift-prerelease.vsix";
64-
await rename(files[1].path, preNewName);
65-
console.log(`Renamed artifact: ${files[1].path} => ${preNewName}`);
74+
await rename(prereleaseVSIX.path, preNewName);
75+
console.log(`Renamed artifact: ${prereleaseVSIX.path} => ${preNewName}`);
6676
await unlink("artifacts.zip");
6777
})();

0 commit comments

Comments
 (0)