feat: Add install-only option for using goreleaser in user scripts (#252)

Co-authored-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
Arunvel Sriram
2020-11-07 01:51:22 +05:30
committed by GitHub
parent 70364181ef
commit f2a4c95ec7
4 changed files with 41 additions and 3 deletions
+10 -1
View File
@@ -2,13 +2,22 @@ import * as git from './git';
import * as installer from './installer';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {dirname} from 'path';
async function run(): Promise<void> {
try {
const version = core.getInput('version') || 'latest';
const args = core.getInput('args', {required: true});
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
const workdir = core.getInput('workdir') || '.';
const goreleaser = await installer.getGoReleaser(version);
core.info(`✅ GoReleaser installed successfully`);
if (isInstallOnly) {
const goreleaserDir = dirname(goreleaser);
core.addPath(goreleaserDir);
core.debug(`Added ${goreleaserDir} to PATH`);
return;
}
const args = core.getInput('args', {required: true});
if (workdir && workdir !== '.') {
core.info(`📂 Using ${workdir} as working directory...`);