Skip to content

Commit

Permalink
Add install-only option for using goreleaser in user scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
arunvelsriram committed Oct 25, 2020
1 parent 4441f83 commit ff990eb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 5 additions & 1 deletion action.yml
Expand Up @@ -11,9 +11,13 @@ inputs:
description: 'GoReleaser version'
default: 'latest'
required: false
install-only:
description: 'Just install GoReleaser'
default: false
required: false
args:
description: 'Arguments to pass to GoReleaser'
required: true
required: true # not required when install-only=true
workdir:
description: 'Working directory (below repository root)'
default: '.'
Expand Down
11 changes: 10 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/main.ts
Expand Up @@ -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 = core.getInput('install-only') === 'true';
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...`);
Expand Down

0 comments on commit ff990eb

Please sign in to comment.