添加go bin到path,执行go version测试命令
Continuous Integration / GitHub Actions Test (push) Successful in 31s Details

This commit is contained in:
soul-walker 2024-03-12 23:16:03 +08:00
parent 8133d8a6e0
commit dd890d8341
5 changed files with 20 additions and 3 deletions

9
dist/index.js vendored
View File

@ -28660,9 +28660,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(2186));
const io = __importStar(__nccwpck_require__(7436));
const os_1 = __importDefault(__nccwpck_require__(2037));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const path_1 = __importDefault(__nccwpck_require__(1017));
const child_process_1 = __importDefault(__nccwpck_require__(2081));
const install_1 = __nccwpck_require__(1649);
/**
* The main function for the action.
@ -28683,8 +28685,13 @@ async function run() {
const installedPath = await (0, install_1.getInstalledGoPath)(version, arch);
const binPath = path_1.default.join(installedPath, 'go', 'bin');
getFiles(binPath);
core.addPath(binPath);
const goPath = await io.which('go');
const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
core.info(`go version cmd result is: ${goVersion}`);
core.setOutput('go-version', goVersion);
// Set outputs for other workflow steps to use
core.setOutput('go-version', version);
// core.setOutput('go-version', version)
}
catch (error) {
// Fail the workflow run if an error occurs

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

1
package-lock.json generated
View File

@ -11,6 +11,7 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/http-client": "^2.2.1",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1"
},
"devDependencies": {

View File

@ -69,6 +69,7 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/http-client": "^2.2.1",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1"
},
"devDependencies": {

View File

@ -1,7 +1,9 @@
import * as core from '@actions/core'
import * as io from '@actions/io'
import os from 'os'
import fs from 'fs'
import path from 'path'
import cp from 'child_process'
import { getInstalledGoPath } from './install'
/**
@ -26,8 +28,14 @@ export async function run(): Promise<void> {
const binPath = path.join(installedPath, 'go', 'bin')
getFiles(binPath)
core.addPath(binPath)
const goPath = await io.which('go')
const goVersion = (cp.execSync(`${goPath} version`) || '').toString()
core.info(`go version cmd result is: ${goVersion}`)
core.setOutput('go-version', goVersion)
// Set outputs for other workflow steps to use
core.setOutput('go-version', version)
// core.setOutput('go-version', version)
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)