Skip to content

Commit 0b35a60

Browse files
Make latest build
1 parent 732ca6c commit 0b35a60

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

dist/index.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68313,13 +68313,26 @@ class LinuxInstaller extends CliInstaller {
6831368313
}
6831468314
}
6831568315

68316+
// EXTERNAL MODULE: external "util"
68317+
var external_util_ = __nccwpck_require__(9023);
68318+
// EXTERNAL MODULE: external "child_process"
68319+
var external_child_process_ = __nccwpck_require__(5317);
68320+
// EXTERNAL MODULE: ./node_modules/semver/index.js
68321+
var semver = __nccwpck_require__(2088);
68322+
var semver_default = /*#__PURE__*/__nccwpck_require__.n(semver);
6831668323
;// CONCATENATED MODULE: ./src/cli-installer/macos.ts
6831768324

6831868325

6831968326

68327+
68328+
68329+
68330+
68331+
const execAsync = (0,external_util_.promisify)(external_child_process_.exec);
6832068332
class MacOSInstaller extends CliInstaller {
6832168333
arch;
6832268334
version;
68335+
minVersionWithMacOSZipInstaller = "2.20.0";
6832368336
constructor(version) {
6832468337
super();
6832568338
this.version = version;
@@ -68330,7 +68343,26 @@ class MacOSInstaller extends CliInstaller {
6833068343
core.info(`Downloading 1Password CLI ${this.version} from ${downloadUrl}`);
6833168344
await super.install(downloadUrl);
6833268345
}
68346+
// CLI releases <2.20.0 doesn't support `.zip` files, and uses `.pkg` files instead,
68347+
// Need to overwrite this to not introduce breaking changes.
68348+
async install(downloadUrl) {
68349+
if (semver_default().gte(this.version, this.minVersionWithMacOSZipInstaller)) {
68350+
await super.install(downloadUrl);
68351+
return;
68352+
}
68353+
const pkgPath = await tool_cache.downloadTool(downloadUrl);
68354+
const { stderr } = await execAsync(`sudo installer -pkg ${pkgPath} -target /`);
68355+
if (stderr) {
68356+
core.error(stderr);
68357+
throw new Error(`Failed to install 1Password CLI: ${stderr}`);
68358+
}
68359+
core.info("1Password CLI installed from MacOS .pkg");
68360+
}
6833368361
downloadUrl() {
68362+
// For versions before 2.20.0, use the .pkg installer
68363+
if (semver_default().lt(this.version, this.minVersionWithMacOSZipInstaller)) {
68364+
return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_apple_universal_${this.version}.pkg`;
68365+
}
6833468366
return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_darwin_${this.arch}_${this.version}.zip`;
6833568367
}
6833668368
getArch() {
@@ -68388,9 +68420,6 @@ var RunnerOS;
6838868420
RunnerOS["Windows"] = "Windows";
6838968421
})(RunnerOS || (RunnerOS = {}));
6839068422

68391-
// EXTERNAL MODULE: ./node_modules/semver/index.js
68392-
var semver = __nccwpck_require__(2088);
68393-
var semver_default = /*#__PURE__*/__nccwpck_require__.n(semver);
6839468423
;// CONCATENATED MODULE: ./src/version/constants.ts
6839568424
var ReleaseChannel;
6839668425
(function (ReleaseChannel) {

0 commit comments

Comments
 (0)