添加go bin到path,执行go version测试命令
All checks were successful
Continuous Integration / GitHub Actions Test (push) Successful in 31s
All checks were successful
Continuous Integration / GitHub Actions Test (push) Successful in 31s
This commit is contained in:
parent
8133d8a6e0
commit
dd890d8341
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
1
package-lock.json
generated
1
package-lock.json
generated
@ -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": {
|
||||
|
@ -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": {
|
||||
|
10
src/main.ts
10
src/main.ts
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user