diff --git a/__tests__/goreleaser.test.ts b/__tests__/goreleaser.test.ts new file mode 100644 index 00000000..a53f6e8a --- /dev/null +++ b/__tests__/goreleaser.test.ts @@ -0,0 +1,33 @@ +import * as fs from 'fs'; +import * as goreleaser from '../src/goreleaser'; + +describe('install', () => { + it('acquires v0.182.0 version of GoReleaser', async () => { + const bin = await goreleaser.install('goreleaser', 'v0.182.0'); + expect(fs.existsSync(bin)).toBe(true); + }, 100000); + + it('acquires latest version of GoReleaser', async () => { + const bin = await goreleaser.install('goreleaser', 'latest'); + expect(fs.existsSync(bin)).toBe(true); + }, 100000); + + it('acquires v0.182.0-pro version of GoReleaser Pro', async () => { + const bin = await goreleaser.install('goreleaser-pro', 'v0.182.0-pro'); + expect(fs.existsSync(bin)).toBe(true); + }, 100000); + + it('acquires latest version of GoReleaser Pro', async () => { + const bin = await goreleaser.install('goreleaser-pro', 'latest'); + expect(fs.existsSync(bin)).toBe(true); + }, 100000); +}); + +describe('distribSuffix', () => { + it('suffixes pro distribution', async () => { + expect(goreleaser.distribSuffix('goreleaser-pro')).toEqual('-pro'); + }); + it('does not suffix oss distribution', async () => { + expect(goreleaser.distribSuffix('goreleaser')).toEqual(''); + }); +}); diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts deleted file mode 100644 index 0749c87e..00000000 --- a/__tests__/installer.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import fs = require('fs'); -import * as installer from '../src/installer'; - -describe('installer', () => { - it('acquires v0.182.0 version of GoReleaser', async () => { - const goreleaser = await installer.getGoReleaser('goreleaser', 'v0.182.0'); - expect(fs.existsSync(goreleaser)).toBe(true); - }, 100000); - - it('acquires latest version of GoReleaser', async () => { - const goreleaser = await installer.getGoReleaser('goreleaser', 'latest'); - expect(fs.existsSync(goreleaser)).toBe(true); - }, 100000); - - it('acquires v0.182.0-pro version of GoReleaser Pro', async () => { - const goreleaser = await installer.getGoReleaser('goreleaser-pro', 'v0.182.0-pro'); - expect(fs.existsSync(goreleaser)).toBe(true); - }, 100000); - - it('acquires latest version of GoReleaser Pro', async () => { - const goreleaser = await installer.getGoReleaser('goreleaser-pro', 'latest'); - expect(fs.existsSync(goreleaser)).toBe(true); - }, 100000); -}); diff --git a/__tests__/pro.test.ts b/__tests__/pro.test.ts deleted file mode 100644 index 9883b32d..00000000 --- a/__tests__/pro.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as pro from '../src/pro'; - -describe('pro', () => { - it('suffixes pro distribution', async () => { - expect(pro.suffix('goreleaser-pro')).toEqual('-pro'); - }); - it('does not suffix oss distribution', async () => { - expect(pro.suffix('goreleaser')).toEqual(''); - }); -}); diff --git a/dist/index.js b/dist/index.js index 5280f820..2dbebf7e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,6 +1,61 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ +/***/ 842: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getInputs = exports.osArch = exports.osPlat = void 0; +const os = __importStar(__nccwpck_require__(87)); +const core = __importStar(__nccwpck_require__(186)); +exports.osPlat = os.platform(); +exports.osArch = os.arch(); +function getInputs() { + return __awaiter(this, void 0, void 0, function* () { + return { + distribution: core.getInput('distribution') || 'goreleaser', + version: core.getInput('version'), + args: core.getInput('args'), + workdir: core.getInput('workdir') || '.', + installOnly: core.getBooleanInput('install') + }; + }); +} +exports.getInputs = getInputs; +//# sourceMappingURL=context.js.map + +/***/ }), + /***/ 374: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -129,10 +184,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRelease = void 0; -const httpm = __importStar(__nccwpck_require__(925)); -const core = __importStar(__nccwpck_require__(186)); +const goreleaser = __importStar(__nccwpck_require__(823)); const semver = __importStar(__nccwpck_require__(911)); -const pro = __importStar(__nccwpck_require__(989)); +const core = __importStar(__nccwpck_require__(186)); +const httpm = __importStar(__nccwpck_require__(925)); const getRelease = (distribution, version) => __awaiter(void 0, void 0, void 0, function* () { const resolvedVersion = (yield resolveVersion(distribution, version)) || version; const url = `https://github.com/goreleaser/${distribution}/releases/${resolvedVersion}`; @@ -146,16 +201,16 @@ const resolveVersion = (distribution, version) => __awaiter(void 0, void 0, void throw new Error(`Cannot find GoReleaser tags`); } core.debug(`Found ${allTags.length} tags in total`); - if (version === 'latest' || !pro.isPro(distribution)) { + if (version === 'latest' || !goreleaser.isPro(distribution)) { return semver.maxSatisfying(allTags, version); } const cleanTags = allTags.map(tag => cleanTag(tag)); const cleanVersion = cleanTag(version); - return semver.maxSatisfying(cleanTags, cleanVersion) + pro.suffix(distribution); + return semver.maxSatisfying(cleanTags, cleanVersion) + goreleaser.distribSuffix(distribution); }); const getAllTags = (distribution) => __awaiter(void 0, void 0, void 0, function* () { const http = new httpm.HttpClient('goreleaser-action'); - const suffix = pro.suffix(distribution); + const suffix = goreleaser.distribSuffix(distribution); const url = `https://goreleaser.com/static/releases${suffix}.json`; const getTags = http.getJson(url); return getTags.then(response => { @@ -172,7 +227,7 @@ const cleanTag = (tag) => { /***/ }), -/***/ 480: +/***/ 823: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -206,17 +261,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getGoReleaser = void 0; -const os = __importStar(__nccwpck_require__(87)); +exports.isPro = exports.distribSuffix = exports.install = void 0; const path = __importStar(__nccwpck_require__(622)); const util = __importStar(__nccwpck_require__(669)); +const context = __importStar(__nccwpck_require__(842)); const github = __importStar(__nccwpck_require__(928)); -const pro = __importStar(__nccwpck_require__(989)); const core = __importStar(__nccwpck_require__(186)); const tc = __importStar(__nccwpck_require__(784)); -const osPlat = os.platform(); -const osArch = os.arch(); -function getGoReleaser(distribution, version) { +function install(distribution, version) { return __awaiter(this, void 0, void 0, function* () { const release = yield github.getRelease(distribution, version); if (!release) { @@ -229,7 +281,7 @@ function getGoReleaser(distribution, version) { core.debug(`Downloaded to ${downloadPath}`); core.info('Extracting GoReleaser'); let extPath; - if (osPlat == 'win32') { + if (context.osPlat == 'win32') { extPath = yield tc.extractZip(downloadPath); } else { @@ -238,15 +290,23 @@ function getGoReleaser(distribution, version) { core.debug(`Extracted to ${extPath}`); const cachePath = yield tc.cacheDir(extPath, 'goreleaser-action', release.tag_name.replace(/^v/, '')); core.debug(`Cached to ${cachePath}`); - const exePath = path.join(cachePath, osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'); + const exePath = path.join(cachePath, context.osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'); core.debug(`Exe path is ${exePath}`); return exePath; }); } -exports.getGoReleaser = getGoReleaser; +exports.install = install; +const distribSuffix = (distribution) => { + return exports.isPro(distribution) ? '-pro' : ''; +}; +exports.distribSuffix = distribSuffix; +const isPro = (distribution) => { + return distribution === 'goreleaser-pro'; +}; +exports.isPro = isPro; const getFilename = (distribution) => { let arch; - switch (osArch) { + switch (context.osArch) { case 'x64': { arch = 'x86_64'; break; @@ -261,19 +321,19 @@ const getFilename = (distribution) => { break; } default: { - arch = osArch; + arch = context.osArch; break; } } - if (osPlat == 'darwin') { + if (context.osPlat == 'darwin') { arch = 'all'; } - const platform = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux'; - const ext = osPlat == 'win32' ? 'zip' : 'tar.gz'; - const suffix = pro.suffix(distribution); + const platform = context.osPlat == 'win32' ? 'Windows' : context.osPlat == 'darwin' ? 'Darwin' : 'Linux'; + const ext = context.osPlat == 'win32' ? 'zip' : 'tar.gz'; + const suffix = exports.distribSuffix(distribution); return util.format('goreleaser%s_%s_%s.%s', suffix, platform, arch, ext); }; -//# sourceMappingURL=installer.js.map +//# sourceMappingURL=goreleaser.js.map /***/ }), @@ -311,42 +371,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __importStar(__nccwpck_require__(622)); +const context = __importStar(__nccwpck_require__(842)); const git = __importStar(__nccwpck_require__(374)); -const installer = __importStar(__nccwpck_require__(480)); +const goreleaser = __importStar(__nccwpck_require__(823)); const core = __importStar(__nccwpck_require__(186)); const exec = __importStar(__nccwpck_require__(514)); -const path_1 = __nccwpck_require__(622); function run() { return __awaiter(this, void 0, void 0, function* () { try { - const distribution = core.getInput('distribution') || 'goreleaser'; - const version = core.getInput('version') || 'latest'; - const args = core.getInput('args'); - const workdir = core.getInput('workdir') || '.'; - const isInstallOnly = /^true$/i.test(core.getInput('install-only')); - const goreleaser = yield installer.getGoReleaser(distribution, version); - core.info(`GoReleaser ${version} installed successfully`); - if (isInstallOnly) { - const goreleaserDir = path_1.dirname(goreleaser); + const inputs = yield context.getInputs(); + const bin = yield goreleaser.install(inputs.distribution, inputs.version); + core.info(`GoReleaser ${inputs.version} installed successfully`); + if (inputs.installOnly) { + const goreleaserDir = path.dirname(bin); core.addPath(goreleaserDir); core.debug(`Added ${goreleaserDir} to PATH`); return; } - else if (!args) { + else if (!inputs.args) { core.setFailed('args input required'); return; } - if (workdir && workdir !== '.') { - core.info(`Using ${workdir} as working directory`); - process.chdir(workdir); + if (inputs.workdir && inputs.workdir !== '.') { + core.info(`Using ${inputs.workdir} as working directory`); + process.chdir(inputs.workdir); } const commit = yield git.getShortCommit(); const tag = yield git.getTag(); const isTagDirty = yield git.isTagDirty(tag); let snapshot = ''; - if (args.split(' ').indexOf('release') > -1) { + if (inputs.args.split(' ').indexOf('release') > -1) { if (isTagDirty) { - if (!args.includes('--snapshot') && !args.includes('--nightly')) { + if (!inputs.args.includes('--snapshot') && !inputs.args.includes('--nightly')) { core.info(`No tag found for commit ${commit}. Snapshot forced`); snapshot = ' --snapshot'; } @@ -355,10 +412,11 @@ function run() { core.info(`${tag} tag found for commit ${commit}`); } } - if (!('GORELEASER_CURRENT_TAG' in process.env)) { - process.env.GORELEASER_CURRENT_TAG = tag; - } - yield exec.exec(`${goreleaser} ${args}${snapshot}`); + yield exec.exec(`${bin} ${inputs.args}${snapshot}`, undefined, { + env: Object.assign({}, process.env, { + GORELEASER_CURRENT_TAG: tag || process.env.GORELEASER_CURRENT_TAG || '' + }) + }); } catch (error) { core.setFailed(error.message); @@ -370,26 +428,7 @@ run(); /***/ }), -/***/ 989: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isPro = exports.suffix = void 0; -const suffix = (distribution) => { - return exports.isPro(distribution) ? '-pro' : ''; -}; -exports.suffix = suffix; -const isPro = (distribution) => { - return distribution === 'goreleaser-pro'; -}; -exports.isPro = isPro; -//# sourceMappingURL=pro.js.map - -/***/ }), - -/***/ 241: +/***/ 351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -523,7 +562,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(241); +const command_1 = __nccwpck_require__(351); const file_command_1 = __nccwpck_require__(717); const utils_1 = __nccwpck_require__(278); const os = __importStar(__nccwpck_require__(87)); @@ -1136,7 +1175,7 @@ const os = __importStar(__nccwpck_require__(87)); const events = __importStar(__nccwpck_require__(614)); const child = __importStar(__nccwpck_require__(129)); const path = __importStar(__nccwpck_require__(622)); -const io = __importStar(__nccwpck_require__(351)); +const io = __importStar(__nccwpck_require__(436)); const ioUtil = __importStar(__nccwpck_require__(962)); const timers_1 = __nccwpck_require__(213); /* eslint-disable @typescript-eslint/unbound-method */ @@ -2582,7 +2621,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 351: +/***/ 436: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3194,7 +3233,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0; const core = __importStar(__nccwpck_require__(186)); -const io = __importStar(__nccwpck_require__(351)); +const io = __importStar(__nccwpck_require__(436)); const fs = __importStar(__nccwpck_require__(747)); const mm = __importStar(__nccwpck_require__(473)); const os = __importStar(__nccwpck_require__(87)); diff --git a/src/context.ts b/src/context.ts new file mode 100644 index 00000000..e0aaeda2 --- /dev/null +++ b/src/context.ts @@ -0,0 +1,23 @@ +import * as os from 'os'; +import * as core from '@actions/core'; + +export const osPlat: string = os.platform(); +export const osArch: string = os.arch(); + +export interface Inputs { + distribution: string; + version: string; + args: string; + workdir: string; + installOnly: boolean; +} + +export async function getInputs(): Promise { + return { + distribution: core.getInput('distribution') || 'goreleaser', + version: core.getInput('version'), + args: core.getInput('args'), + workdir: core.getInput('workdir') || '.', + installOnly: core.getBooleanInput('install') + }; +} diff --git a/src/github.ts b/src/github.ts index ed3c3d4f..30a18096 100644 --- a/src/github.ts +++ b/src/github.ts @@ -1,7 +1,7 @@ -import * as httpm from '@actions/http-client'; -import * as core from '@actions/core'; +import * as goreleaser from './goreleaser'; import * as semver from 'semver'; -import * as pro from './pro'; +import * as core from '@actions/core'; +import * as httpm from '@actions/http-client'; export interface GitHubRelease { id: number; @@ -22,13 +22,13 @@ const resolveVersion = async (distribution: string, version: string): Promise = allTags.map(tag => cleanTag(tag)); const cleanVersion: string = cleanTag(version); - return semver.maxSatisfying(cleanTags, cleanVersion) + pro.suffix(distribution); + return semver.maxSatisfying(cleanTags, cleanVersion) + goreleaser.distribSuffix(distribution); }; interface GitHubTag { @@ -37,15 +37,13 @@ interface GitHubTag { const getAllTags = async (distribution: string): Promise> => { const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action'); - const suffix: string = pro.suffix(distribution); + const suffix: string = goreleaser.distribSuffix(distribution); const url: string = `https://goreleaser.com/static/releases${suffix}.json`; const getTags = http.getJson>(url); - return getTags.then(response => { if (response.result == null) { return []; } - return response.result.map(obj => obj.tag_name); }); }; diff --git a/src/installer.ts b/src/goreleaser.ts similarity index 66% rename from src/installer.ts rename to src/goreleaser.ts index 4aeffb65..dce4297c 100644 --- a/src/installer.ts +++ b/src/goreleaser.ts @@ -1,15 +1,11 @@ -import * as os from 'os'; import * as path from 'path'; import * as util from 'util'; +import * as context from './context'; import * as github from './github'; -import * as pro from './pro'; import * as core from '@actions/core'; import * as tc from '@actions/tool-cache'; -const osPlat: string = os.platform(); -const osArch: string = os.arch(); - -export async function getGoReleaser(distribution: string, version: string): Promise { +export async function install(distribution: string, version: string): Promise { const release: github.GitHubRelease | null = await github.getRelease(distribution, version); if (!release) { throw new Error(`Cannot find GoReleaser ${version} release`); @@ -29,7 +25,7 @@ export async function getGoReleaser(distribution: string, version: string): Prom core.info('Extracting GoReleaser'); let extPath: string; - if (osPlat == 'win32') { + if (context.osPlat == 'win32') { extPath = await tc.extractZip(downloadPath); } else { extPath = await tc.extractTar(downloadPath); @@ -39,15 +35,23 @@ export async function getGoReleaser(distribution: string, version: string): Prom const cachePath: string = await tc.cacheDir(extPath, 'goreleaser-action', release.tag_name.replace(/^v/, '')); core.debug(`Cached to ${cachePath}`); - const exePath: string = path.join(cachePath, osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'); + const exePath: string = path.join(cachePath, context.osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'); core.debug(`Exe path is ${exePath}`); return exePath; } +export const distribSuffix = (distribution: string): string => { + return isPro(distribution) ? '-pro' : ''; +}; + +export const isPro = (distribution: string): boolean => { + return distribution === 'goreleaser-pro'; +}; + const getFilename = (distribution: string): string => { let arch: string; - switch (osArch) { + switch (context.osArch) { case 'x64': { arch = 'x86_64'; break; @@ -62,15 +66,15 @@ const getFilename = (distribution: string): string => { break; } default: { - arch = osArch; + arch = context.osArch; break; } } - if (osPlat == 'darwin') { + if (context.osPlat == 'darwin') { arch = 'all'; } - const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux'; - const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz'; - const suffix: string = pro.suffix(distribution); + const platform: string = context.osPlat == 'win32' ? 'Windows' : context.osPlat == 'darwin' ? 'Darwin' : 'Linux'; + const ext: string = context.osPlat == 'win32' ? 'zip' : 'tar.gz'; + const suffix: string = distribSuffix(distribution); return util.format('goreleaser%s_%s_%s.%s', suffix, platform, arch, ext); }; diff --git a/src/main.ts b/src/main.ts index e3a4f4b9..eb573857 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,32 +1,29 @@ +import * as path from 'path'; +import * as context from './context'; import * as git from './git'; -import * as installer from './installer'; +import * as goreleaser from './goreleaser'; import * as core from '@actions/core'; import * as exec from '@actions/exec'; -import {dirname} from 'path'; async function run(): Promise { try { - const distribution = core.getInput('distribution') || 'goreleaser'; - const version = core.getInput('version') || 'latest'; - const args = core.getInput('args'); - const workdir = core.getInput('workdir') || '.'; - const isInstallOnly = /^true$/i.test(core.getInput('install-only')); - const goreleaser = await installer.getGoReleaser(distribution, version); - core.info(`GoReleaser ${version} installed successfully`); + const inputs: context.Inputs = await context.getInputs(); + const bin = await goreleaser.install(inputs.distribution, inputs.version); + core.info(`GoReleaser ${inputs.version} installed successfully`); - if (isInstallOnly) { - const goreleaserDir = dirname(goreleaser); + if (inputs.installOnly) { + const goreleaserDir = path.dirname(bin); core.addPath(goreleaserDir); core.debug(`Added ${goreleaserDir} to PATH`); return; - } else if (!args) { + } else if (!inputs.args) { core.setFailed('args input required'); return; } - if (workdir && workdir !== '.') { - core.info(`Using ${workdir} as working directory`); - process.chdir(workdir); + if (inputs.workdir && inputs.workdir !== '.') { + core.info(`Using ${inputs.workdir} as working directory`); + process.chdir(inputs.workdir); } const commit = await git.getShortCommit(); @@ -34,9 +31,9 @@ async function run(): Promise { const isTagDirty = await git.isTagDirty(tag); let snapshot = ''; - if (args.split(' ').indexOf('release') > -1) { + if (inputs.args.split(' ').indexOf('release') > -1) { if (isTagDirty) { - if (!args.includes('--snapshot') && !args.includes('--nightly')) { + if (!inputs.args.includes('--snapshot') && !inputs.args.includes('--nightly')) { core.info(`No tag found for commit ${commit}. Snapshot forced`); snapshot = ' --snapshot'; } @@ -45,10 +42,13 @@ async function run(): Promise { } } - if (!('GORELEASER_CURRENT_TAG' in process.env)) { - process.env.GORELEASER_CURRENT_TAG = tag; - } - await exec.exec(`${goreleaser} ${args}${snapshot}`); + await exec.exec(`${bin} ${inputs.args}${snapshot}`, undefined, { + env: Object.assign({}, process.env, { + GORELEASER_CURRENT_TAG: tag || process.env.GORELEASER_CURRENT_TAG || '' + }) as { + [key: string]: string; + } + }); } catch (error) { core.setFailed(error.message); } diff --git a/src/pro.ts b/src/pro.ts deleted file mode 100644 index 46f25fc7..00000000 --- a/src/pro.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const suffix = (distribution: string): string => { - return isPro(distribution) ? '-pro' : ''; -}; - -export const isPro = (distribution: string): boolean => { - return distribution === 'goreleaser-pro'; -};