mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-02-23 12:20:10 +08:00
Fail builds on non-zero exit codes.
This commit is contained in:
parent
77fd73038b
commit
b3777a3c57
@ -1,6 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import {GRAALVM_PLATFORM} from './constants'
|
||||
import {exec} from '@actions/exec'
|
||||
import {exec} from './utils'
|
||||
|
||||
const APT_GET_INSTALL_BASE = 'sudo apt-get -y --no-upgrade install'
|
||||
const COMPONENT_TO_DEPS = new Map<string, Map<string, string>>([
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import {IS_LINUX} from './constants'
|
||||
import {exec} from '@actions/exec'
|
||||
import {exec} from './utils'
|
||||
import {join} from 'path'
|
||||
|
||||
const MUSL_NAME = 'x86_64-linux-musl-native'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {GRAALVM_PLATFORM} from './constants'
|
||||
import {exec} from '@actions/exec'
|
||||
import {exec} from './utils'
|
||||
import {join} from 'path'
|
||||
|
||||
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress']
|
||||
|
16
src/utils.ts
16
src/utils.ts
@ -2,6 +2,7 @@ import * as c from './constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import {ExecOptions, exec as e} from '@actions/exec'
|
||||
import {readFileSync, readdirSync} from 'fs'
|
||||
import {Octokit} from '@octokit/core'
|
||||
import {createHash} from 'crypto'
|
||||
@ -16,6 +17,21 @@ const GitHub = Octokit.defaults({
|
||||
}
|
||||
})
|
||||
|
||||
export async function exec(
|
||||
commandLine: string,
|
||||
args?: string[],
|
||||
options?: ExecOptions | undefined
|
||||
): Promise<void> {
|
||||
const exitCode = await e(commandLine, args, options)
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(
|
||||
`'${[commandLine]
|
||||
.concat(args || [])
|
||||
.join(' ')}' exited with a non-zero code: ${exitCode}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export async function getLatestRelease(
|
||||
repo: string
|
||||
): Promise<c.LatestReleaseResponse['data']> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user