@@ -68280,7 +68280,6 @@ class CliInstaller {
6828068280;// CONCATENATED MODULE: ./src/cli-installer/linux.ts
6828168281
6828268282
68283-
6828468283class LinuxInstaller extends CliInstaller {
6828568284 arch;
6828668285 version;
@@ -68291,7 +68290,6 @@ class LinuxInstaller extends CliInstaller {
6829168290 }
6829268291 async installCli() {
6829368292 const downloadUrl = this.downloadUrl();
68294- core.info(`Downloading 1Password CLI ${this.version} from ${downloadUrl}`);
6829568293 await super.install(downloadUrl);
6829668294 }
6829768295 downloadUrl() {
@@ -68321,107 +68319,6 @@ var external_child_process_ = __nccwpck_require__(5317);
6832168319// EXTERNAL MODULE: ./node_modules/semver/index.js
6832268320var semver = __nccwpck_require__(2088);
6832368321var semver_default = /*#__PURE__*/__nccwpck_require__.n(semver);
68324- ;// CONCATENATED MODULE: ./src/cli-installer/macos.ts
68325-
68326-
68327-
68328-
68329-
68330-
68331-
68332- const execAsync = (0,external_util_.promisify)(external_child_process_.exec);
68333- class MacOSInstaller extends CliInstaller {
68334- arch;
68335- version;
68336- minVersionWithMacOSZipInstaller = "2.20.0";
68337- constructor(version) {
68338- super();
68339- this.version = version;
68340- this.arch = this.getArch();
68341- }
68342- async installCli() {
68343- const downloadUrl = this.downloadUrl();
68344- core.info(`Downloading 1Password CLI ${this.version} from ${downloadUrl}`);
68345- await this.installOnMacOS(downloadUrl);
68346- }
68347- downloadUrl() {
68348- // For versions before 2.20.0, use the .pkg installer
68349- if (semver_default().lt(this.version, this.minVersionWithMacOSZipInstaller)) {
68350- return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_apple_universal_${this.version}.pkg`;
68351- }
68352- return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_darwin_${this.arch}_${this.version}.zip`;
68353- }
68354- getArch() {
68355- switch (process.env.RUNNER_ARCH) {
68356- case RunnerArch.X64:
68357- return "amd64";
68358- case RunnerArch.ARM64:
68359- return "arm64";
68360- default:
68361- throw new Error(`Unsupported RUNNER_ARCH value for macOS: ${process.env.RUNNER_ARCH}`);
68362- }
68363- }
68364- // CLI releases <2.20.0 doesn't support `.zip` files, and uses `.pkg` files instead,
68365- // Need to overwrite this to not introduce breaking changes.
68366- async installOnMacOS(downloadUrl) {
68367- if (semver_default().gte(this.version, this.minVersionWithMacOSZipInstaller)) {
68368- await super.install(downloadUrl);
68369- return;
68370- }
68371- core.info("Installing 1Password CLI using MacOS .pkg installer");
68372- const pkgPath = await tool_cache.downloadTool(downloadUrl);
68373- const { stderr } = await execAsync(`sudo installer -pkg ${pkgPath} -target /`);
68374- if (stderr) {
68375- core.error(stderr);
68376- throw new Error(`Failed to install 1Password CLI: ${stderr}`);
68377- }
68378- core.info("1Password CLI installed from MacOS .pkg");
68379- }
68380- }
68381-
68382- ;// CONCATENATED MODULE: ./src/cli-installer/windows.ts
68383-
68384-
68385- class WindowsInstaller extends CliInstaller {
68386- arch;
68387- version;
68388- constructor(version) {
68389- super();
68390- this.version = version;
68391- this.arch = "amd64"; // GitHub-hosted Windows runners (like windows-latest, windows-2022, windows-2019) are all 64-bit Windows Server VMs.
68392- }
68393- async installCli() {
68394- const downloadUrl = this.downloadUrl();
68395- core.info(`Downloading 1Password CLI ${this.version} from ${downloadUrl}`);
68396- await super.install(downloadUrl);
68397- }
68398- downloadUrl() {
68399- return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_windows_${this.arch}_${this.version}.zip`;
68400- }
68401- }
68402-
68403- ;// CONCATENATED MODULE: ./src/cli-installer/index.ts
68404-
68405-
68406-
68407- // Defines the architecture of the runner executing the job.
68408- // Look `RUNNER_ARCH` for possible values (https://docs.github.com/en/actions/reference/variables-reference).
68409- var RunnerArch;
68410- (function (RunnerArch) {
68411- RunnerArch["X64"] = "X64";
68412- RunnerArch["X86"] = "X86";
68413- RunnerArch["ARM"] = "ARM";
68414- RunnerArch["ARM64"] = "ARM64";
68415- })(RunnerArch || (RunnerArch = {}));
68416- // RunnerOS defines the operating system of the runner executing the job.
68417- // Look `RUNNER_OS` for possible values (https://docs.github.com/en/actions/reference/variables-reference).
68418- var RunnerOS;
68419- (function (RunnerOS) {
68420- RunnerOS["Linux"] = "Linux";
68421- RunnerOS["MacOS"] = "macOS";
68422- RunnerOS["Windows"] = "Windows";
68423- })(RunnerOS || (RunnerOS = {}));
68424-
6842568322;// CONCATENATED MODULE: ./src/version/constants.ts
6842668323var ReleaseChannel;
6842768324(function (ReleaseChannel) {
@@ -88231,7 +88128,7 @@ const findVersions = ($, query) => {
8823188128 });
8823288129 return versions;
8823388130};
88234- const normalizeBetaForSemver = (version) => version.replace(/-beta\.0*(\d+)/, "-beta.$1");
88131+ const normalizeForSemver = (version) => version.replace(/-beta\.0*(\d+)/, "-beta.$1");
8823588132// Returns the latest version of the 1Password CLI based on the specified channel.
8823688133const getLatestVersion = async (versionType) => {
8823788134 core.info(`Getting ${versionType} version number`);
@@ -88246,12 +88143,8 @@ const getLatestVersion = async (versionType) => {
8824688143 }
8824788144 // Sort versions in descending order
8824888145 versions.sort((a, b) => {
88249- const na = normalizeBetaForSemver(a);
88250- core.info(`Normalized version A: ${na}`);
88251- const nb = normalizeBetaForSemver(b);
88252- core.info(`Normalized version B: ${nb}`);
88253- const aNorm = new (semver_default()).SemVer(na);
88254- const bNorm = new (semver_default()).SemVer(nb);
88146+ const aNorm = new (semver_default()).SemVer(normalizeForSemver(a));
88147+ const bNorm = new (semver_default()).SemVer(normalizeForSemver(b));
8825588148 return semver_default().rcompare(aNorm, bNorm);
8825688149 });
8825788150 return versions[0];
@@ -88271,7 +88164,7 @@ const validateVersion = (input) => {
8827188164 // That's why we need to normalize them before validating.
8827288165 // Accepts valid semver versions like "2.18.0" or beta-releases like "2.19.0-beta.01"
8827388166 // or versions with 'v' prefix like "v2.19.0"
88274- const normalized = normalizeBetaForSemver (input);
88167+ const normalized = normalizeForSemver (input);
8827588168 const normInput = new (semver_default()).SemVer(normalized);
8827688169 if (semver_default().valid(normInput)) {
8827788170 return;
@@ -88318,6 +88211,107 @@ class VersionResolver {
8831888211;// CONCATENATED MODULE: ./src/version/index.ts
8831988212
8832088213
88214+
88215+ ;// CONCATENATED MODULE: ./src/cli-installer/macos.ts
88216+
88217+
88218+
88219+
88220+
88221+
88222+
88223+
88224+ const execAsync = (0,external_util_.promisify)(external_child_process_.exec);
88225+ class MacOSInstaller extends CliInstaller {
88226+ arch;
88227+ version;
88228+ minVersionWithMacOSZipInstaller = "2.20.0";
88229+ constructor(version) {
88230+ super();
88231+ this.version = version;
88232+ this.arch = this.getArch();
88233+ }
88234+ async installCli() {
88235+ const downloadUrl = this.downloadUrl();
88236+ core.info(`Downloading 1Password CLI ${this.version} from ${downloadUrl}`);
88237+ await this.installOnMacOS(downloadUrl);
88238+ }
88239+ downloadUrl() {
88240+ // For versions before 2.20.0, use the .pkg installer
88241+ if (semver_default().lt(normalizeForSemver(this.version), this.minVersionWithMacOSZipInstaller)) {
88242+ return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_apple_universal_${this.version}.pkg`;
88243+ }
88244+ return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_darwin_${this.arch}_${this.version}.zip`;
88245+ }
88246+ getArch() {
88247+ switch (process.env.RUNNER_ARCH) {
88248+ case RunnerArch.X64:
88249+ return "amd64";
88250+ case RunnerArch.ARM64:
88251+ return "arm64";
88252+ default:
88253+ throw new Error(`Unsupported RUNNER_ARCH value for macOS: ${process.env.RUNNER_ARCH}`);
88254+ }
88255+ }
88256+ // CLI releases <2.20.0 doesn't support `.zip` files, and uses `.pkg` files instead,
88257+ // Need to overwrite this to not introduce breaking changes.
88258+ async installOnMacOS(downloadUrl) {
88259+ if (semver_default().gte(normalizeForSemver(this.version), this.minVersionWithMacOSZipInstaller)) {
88260+ await super.install(downloadUrl);
88261+ return;
88262+ }
88263+ core.info("Installing 1Password CLI using MacOS .pkg installer");
88264+ const pkgPath = await tool_cache.downloadTool(downloadUrl);
88265+ const { stderr } = await execAsync(`sudo installer -pkg ${pkgPath} -target /`);
88266+ if (stderr) {
88267+ core.error(stderr);
88268+ throw new Error(`Failed to install 1Password CLI: ${stderr}`);
88269+ }
88270+ core.info("1Password CLI installed from MacOS .pkg");
88271+ }
88272+ }
88273+
88274+ ;// CONCATENATED MODULE: ./src/cli-installer/windows.ts
88275+
88276+ class WindowsInstaller extends CliInstaller {
88277+ arch;
88278+ version;
88279+ constructor(version) {
88280+ super();
88281+ this.version = version;
88282+ this.arch = "amd64"; // GitHub-hosted Windows runners (like windows-latest, windows-2022, windows-2019) are all 64-bit Windows Server VMs.
88283+ }
88284+ async installCli() {
88285+ const downloadUrl = this.downloadUrl();
88286+ await super.install(downloadUrl);
88287+ }
88288+ downloadUrl() {
88289+ return `https://cache.agilebits.com/dist/1P/op2/pkg/${this.version}/op_windows_${this.arch}_${this.version}.zip`;
88290+ }
88291+ }
88292+
88293+ ;// CONCATENATED MODULE: ./src/cli-installer/index.ts
88294+
88295+
88296+
88297+ // Defines the architecture of the runner executing the job.
88298+ // Look `RUNNER_ARCH` for possible values (https://docs.github.com/en/actions/reference/variables-reference).
88299+ var RunnerArch;
88300+ (function (RunnerArch) {
88301+ RunnerArch["X64"] = "X64";
88302+ RunnerArch["X86"] = "X86";
88303+ RunnerArch["ARM"] = "ARM";
88304+ RunnerArch["ARM64"] = "ARM64";
88305+ })(RunnerArch || (RunnerArch = {}));
88306+ // RunnerOS defines the operating system of the runner executing the job.
88307+ // Look `RUNNER_OS` for possible values (https://docs.github.com/en/actions/reference/variables-reference).
88308+ var RunnerOS;
88309+ (function (RunnerOS) {
88310+ RunnerOS["Linux"] = "Linux";
88311+ RunnerOS["MacOS"] = "macOS";
88312+ RunnerOS["Windows"] = "Windows";
88313+ })(RunnerOS || (RunnerOS = {}));
88314+
8832188315;// CONCATENATED MODULE: ./src/index.ts
8832288316
8832388317
0 commit comments