Use install-cli-action to enable windows support
This commit is contained in:
@@ -5,6 +5,9 @@ branding:
|
||||
icon: lock
|
||||
color: blue
|
||||
inputs:
|
||||
version:
|
||||
description: Version of the 1Password CLI to install
|
||||
default: latest
|
||||
unset-previous:
|
||||
description: Whether to unset environment variables populated by 1Password in earlier job steps
|
||||
default: "false"
|
||||
|
||||
39678
dist/index.js
vendored
39678
dist/index.js
vendored
File diff suppressed because one or more lines are too long
523
package-lock.json
generated
523
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -39,9 +39,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/1Password/load-secrets-action#readme",
|
||||
"dependencies": {
|
||||
"@1password/install-cli-action": "github:1password/install-cli-action#vzt/export-install-function",
|
||||
"@1password/op-js": "^0.1.11",
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/exec": "^1.1.1"
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/tool-cache": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@1password/eslint-config": "^4.3.1",
|
||||
|
||||
22
src/index.ts
22
src/index.ts
@@ -1,9 +1,6 @@
|
||||
import path from "path";
|
||||
import url from "url";
|
||||
import * as core from "@actions/core";
|
||||
import * as exec from "@actions/exec";
|
||||
import { validateCli } from "@1password/op-js";
|
||||
import { loadSecrets, unsetPrevious, validateAuth } from "./utils";
|
||||
import { validateCli } from "@1password/op-js";
|
||||
|
||||
const loadSecretsAction = async () => {
|
||||
try {
|
||||
@@ -46,21 +43,8 @@ const installCLI = async (): Promise<void> => {
|
||||
// If there's no CLI installed, then validateCli will throw an error, which we will use
|
||||
// as an indicator that we need to execute the installation script.
|
||||
await validateCli().catch(async () => {
|
||||
const currentFile = url.fileURLToPath(import.meta.url);
|
||||
const currentDir = path.dirname(currentFile);
|
||||
const parentDir = path.resolve(currentDir, "..");
|
||||
|
||||
// Execute bash script
|
||||
const cmdOut = await exec.getExecOutput(
|
||||
`sh -c "` + parentDir + `/install_cli.sh"`,
|
||||
);
|
||||
|
||||
// Add path to 1Password CLI to $PATH
|
||||
const outArr = cmdOut.stdout.split("\n");
|
||||
if (outArr[0] && process.env.PATH) {
|
||||
const cliPath = outArr[0]?.replace(/^(::debug::OP_INSTALL_DIR: )/, "");
|
||||
core.addPath(cliPath);
|
||||
}
|
||||
const { install } = require("@1password/install-cli-action");
|
||||
await install();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
"target": "es2022",
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user